Chinese | string | String we usually need to write the current date on the WEB page, possibly using the client script, or using ASP. One feature of using ASP is that it produces an effect that looks like a static page, but it is actually generated dynamically. If you want to use ASP to display a Chinese date, you need to translate it. Here is the function to transform and its invocation instance.
[[function Implementation]]
[%
'======================================================
' Function Date2chinese
' function: String to get Chinese date (e.g. May 12, 1998)
' Parameter: idate date to convert
' Return: string of Chinese date
'======================================================
Function Date2chinese (Idate)
Dim Num (10)
Dim iyear
Dim Imonth
Dim Iday
num (0) = "0"
num (1) = "One"
num (2) = "Two"
num (3) = "three"
num (4) = "Four"
num (5) = "Five"
num (6) = "Six"
num (7) = "Seven"
num (8) = "Eight"
num (9) = "Nine"
Iyear = year (Idate)
Imonth = Month (Idate)
Iday = Day (Idate)
Date2chinese = num (iyear \ 1000) + _
Num ((iyear) Mod + num (iyear _
MoD) + num (iyear mod _
10) + "year"
If Imonth]= Then
If Imonth = Ten Then
Date2chinese = Date2chinese + _
"Ten" + "month"
Else
Date2chinese = Date2chinese + _
"Ten" + num (imonth Mod 10) + "Month"
End If
Else
Date2chinese = Date2chinese + _
Num (imonth Mod 10) + "Month"
End If
If Iday]= Then
If Iday = Ten Then
Date2chinese = Date2chinese + _
"Ten" + "Day"
ElseIf Iday = Or Iday = Then
Date2chinese = Date2chinese + _
Num (iday \ 10) + "Ten" + "Day"
ElseIf Iday] Then
Date2chinese = Date2chinese + _
Num (iday \ 10) + "Ten" + _
Num (iday Mod 10) + "Day"
Else
Date2chinese = Date2chinese + _
"Ten" + num (iday Mod 10) + "Day"
End If
Else
Date2chinese = Date2chinese + _
Num (iday Mod 10) + "Day"
End If
End Function
%]
[[Call example]]
[%
Response.Write Date2chinese (Date ())
%]