|
- response.write ShowDataInfo(now(),"Y年m月d日 H:I:S 周")
- Function ShowDataInfo(DateTime,ShowType)
- if isBlank(DateTime) then Exit Function
- Dim DateMonth,DateDay,DateHour,DateMinute,DateWeek,DateSecond
- Dim FullWeekday,shortWeekday,WeekdayCN,Fullmonth,Shortmonth,TimeZone1,TimeZone2
- TimeZone1="+0800"
- TimeZone2="+08:00"
- FullWeekday=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
- shortWeekday=Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
- WeekdayCN=Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六")
- Fullmonth=Array("January","February","March","April","May","June","July","August","September","October","November","December")
- Shortmonth=Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
- DateMonth=Month(DateTime)
- DateDay=Day(DateTime)
- DateHour=Hour(DateTime)
- DateMinute=Minute(DateTime)
- DateWeek=weekday(DateTime)
- DateSecond=Second(DateTime)
- if Len(DateMonth)<2 then DateMonth="0"&DateMonth
- if Len(DateDay)<2 then DateDay="0"&DateDay
- if Len(DateMinute)<2 then DateMinute="0"&DateMinute
- Select Case ShowType
- Case "Y-m-d" ShowDataInfo=Year(DateTime)&"-"&DateMonth&"-"&DateDay
- Case "m.d" ShowDataInfo=DateMonth&"."&DateDay
- Case "Y.m.d" ShowDataInfo=Year(DateTime)&"."&DateMonth&"."&DateDay
- Case "Y-m-d w" ShowDataInfo=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&FullWeekday(DateWeek-1)
- Case "Y年m月d日" ShowDataInfo=Year(DateTime)&"年"&DateMonth&"月"&DateDay&"日"
- Case "Y年m月d日 周" ShowDataInfo=Year(DateTime)&"年"&DateMonth&"月"&DateDay&"日 "&WeekdayCN(DateWeek-1)
- Case "Y年m月d日 H:I:S 周" ShowDataInfo=Year(DateTime)&"年"&DateMonth&"月"&DateDay&"日 "&DateHour&":"&DateMinute&":"&DateSecond&" "&WeekdayCN(DateWeek-1)
- Case "Y-m-d H:I A"
- Dim DateAMPM
- if DateHour>12 then
- DateHour=DateHour-12
- DateAMPM="PM"
- else
- DateHour=DateHour
- DateAMPM="AM"
- end if
- if Len(DateHour)<2 then DateHour="0"&DateHour
- ShowDataInfo=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute&" "&DateAMPM
- Case "Y-m-d H:I:S"
- if Len(DateHour)<2 then DateHour="0"&DateHour
- if Len(DateSecond)<2 then DateSecond="0"&DateSecond
- ShowDataInfo=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute&":"&DateSecond
- Case "Y-m-d H:I:S w"
- if Len(DateHour)<2 then DateHour="0"&DateHour
- if Len(DateSecond)<2 then DateSecond="0"&DateSecond
- ShowDataInfo=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute&":"&DateSecond&" "&FullWeekday(DateWeek-1)
- Case "YmdHIS"
- DateSecond=Second(DateTime)
- if Len(DateHour)<2 then DateHour="0"&DateHour
- if Len(DateSecond)<2 then DateSecond="0"&DateSecond
- ShowDataInfo=Year(DateTime)&DateMonth&DateDay&DateHour&DateMinute&DateSecond
- Case "ym" ShowDataInfo=Right(Year(DateTime),2)&DateMonth
- Case "d" ShowDataInfo=DateDay
- Case "ymd" ShowDataInfo=Right(Year(DateTime),4)&DateMonth&DateDay
- Case "mdy"
- Dim DayEnd
- Select Case DateDay
- Case 1 DayEnd="st"
- Case 2 DayEnd="nd"
- Case 3 DayEnd="rd"
- Case else DayEnd="th"
- End Select
- ShowDataInfo=Fullmonth(DateMonth-1)&" "&DateDay&DayEnd&" "&Right(Year(DateTime),4)
- Case "w,d m y H:I:S"
- DateSecond=Second(DateTime)
- if Len(DateHour)<2 then DateHour="0"&DateHour
- if Len(DateSecond)<2 then DateSecond="0"&DateSecond
- ShowDataInfo=shortWeekday(DateWeek-1)&","&DateDay&" "& Left(Fullmonth(DateMonth-1),3) &" "&Right(Year(DateTime),4)&" "&DateHour&":"&DateMinute&":"&DateSecond&" "&TimeZone1
- Case "y-m-dTH:I:S"
- if Len(DateHour)<2 then DateHour="0"&DateHour
- if Len(DateSecond)<2 then DateSecond="0"&DateSecond
- ShowDataInfo=Year(DateTime)&"-"&DateMonth&"-"&DateDay&"T"&DateHour&":"&DateMinute&":"&DateSecond&TimeZone2
- Case else
- if Len(DateHour)<2 then DateHour="0"&DateHour
- ShowDataInfo=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute
- End Select
- End Function
复制代码 |
评分
-
查看全部评分
|