<%=month(date)&"月"&day(date)&"日"%> <%=date()%> 年 year(now()) 月 month(now()) 日 day(now()) 2位月 right("0"&month(now()),2) 2位日 right("0"&day(now()),2) *獲取當(dāng)前日期:
Year(now())&"-"&month(now())&"-"&day(now()) <%=trim(year(now()))&"年"&trim(month(now()))&"月"&trim(day(now()))&"日"%> 獲得當(dāng)前日期: prdate=trim(year(now()))&"年"&trim(month(now()))&"月"&trim(day(now()))&"日" 獲得表單日期: prdate=trim(request.form("prdate") prdate=trim(year(prdate))&"年"&trim(month(prdate))&"月"&trim(day(prdate))&"日"
response.wrtie prdate 可自由選擇不同的日期顯示樣式: ============================================ ' 格式化時間(顯示) ' 參數(shù):n_Flag ' 1:"yyyy-mm-dd hh:mm:ss" ' 2:"yyyy-mm-dd" ' 3:"hh:mm:ss" ' 4:"yyyy年mm月dd日" ' 5:"yyyymmdd" ' ============================================ 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-dd hh:mm:ss Format_Time = y & "-" & m & "-" & d & " " & h & ":" & mi & ":" & s Case 2 ' yyyy-mm-dd Format_Time = y & "-" & m & "-" & d Case 3 ' hh:mm:ss Format_Time = h & ":" & mi & ":" & s Case 4 ' yyyy年mm月dd日 Format_Time = y & "年" & m & "月" & d & "日" Case 5 ' yyyymmdd Format_Time = y & m & d End Select End Function
給你寫了個簡單的Function: Function SenFe_Date(Content) If IsDate(Content) = False Then Exit Function Content = CDate(Content) SenFe_Date = Right(Year(Content),2)&"-"& Right("0"&Day(Content),2)&"-"&Right("0"&Month(Content),2) End Function 調(diào)用時Content為標(biāo)準(zhǔn)日期表達(dá)式 |