asp & acc 关于时间格式改变

来源:百度知道 编辑:UC知道 时间:2024/05/23 12:50:37
一下是源代码:我的问题是如何把时间格式“6:15”和“hh:mm”格式变成如“2009年1月1日”或者“2009-1-1”的格式,万分感谢

<!-- #include file="../inc/config.asp" -->
<!-- #include file="Login_Check.asp" -->
<%if session("quanxian")=2 or session("quanxian")=1 then%>
<html>
<link href="../img/admin.css" type="text/css" rel="stylesheet" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>公交线路的添加</title>
</head>
<script language="javascript" type="text/javascript">
<!--
function check_form(){
var qm=document.form;
if (qm.qmroute_name.value==""){
alert("公交线路名不能够为空!");
return false;
}
if (qm.bus_rate.value==""){
alert("公交车票价不能够为空!");
return false;
}
if (qm.bus_ratebz.valu

貌似不行吧,你原来格式里没有年 怎么能变出年来。如果有年的话 可以用函数转换
'============================================
' 格式化时间(显示)
' 参数:n_Flag
' 1:"yyyy-mm-dd hh:mm:ss" 2:"yyyy-mm-dd" 3:"hh:mm:ss" 4:"yyyy年mm月dd日" 5:"yyyymmdd" 6:mm-dd
' ============================================
Function Format_Time(s_Time, n_Flag)
Dim y, m, d, h, mi, s
Format_Time = ""
If IsDate(s_Time) = False Then Exit Function
y = cstr(year(s_Time))
m = cstr(month(s_Time))
If len(m) = 1 Then m = "0" & m
d = cstr(day(s_Time))
If len(d) = 1 Then d = "0" & d
h = cstr(hour(s_Time))
If len(h) = 1 Then h = "0" & h
mi = cstr(minute(s_Time))
If len(mi) = 1 Then mi = "0" & mi
s = cstr(second(s_Time))
If len(s) = 1 Then s = "0" & s
Select Case n_Flag
Case 1
' yyyy-mm-