常用ASP函数集【经验才是最重要的】(11)
Case "ym"
DateToStr=Right(Year(DateTime),2)&DateMonth
Case "d"
DateToStr=DateDay
Case Else
If Len(DateHour)<2 Then DateHour="0"&DateHour
If Len(DateMinute)<2 Then DateMinute="0"&DateMinute
DateToStr=Year(DateTime)&"-"&DateMonth&"-"&DateDay&" "&DateHour&":"&DateMinute
End Select
End Function
Function Date2Chinese(iDate) '获得ASP的中文日期字符串
Dim num(10)
Dim iYear
Dim iMonth
Dim iDay
num(0) = "〇"
num(1) = "一"
num(2) = "二"
num(3) = "三"
num(4) = "四"
num(5) = "五"
num(6) = "六"
num(7) = "七"
num(8) = "八"
num(9) = "九"
iYear = Year(iDate)
iMonth = Month(iDate)
iDay = Day(iDate)
Date2Chinese = num(iYear \ 1000) + num((iYear \ 100) Mod 10) + num((iYear\ 10) Mod 10) + num(iYear Mod 10) + "年"
If iMonth >= 10 Then
If iMonth = 10 Then
Date2Chinese = Date2Chinese + "十" + "月"
Else
Date2Chinese = Date2Chinese + "十" + num(iMonth Mod 10) + "月"
End If
Else
Date2Chinese = Date2Chinese + num(iMonth Mod 10) + "月"
End If
If iDay >= 10 Then
If iDay = 10 Then
Date2Chinese = Date2Chinese +"十" + "日"
ElseIf iDay = 20 or iDay = 30 Then
Date2Chinese = Date2Chinese + num(iDay \ 10) + "十" + "日"
内容版权声明:除非注明,否则皆为本站原创文章。