Get ASP Chinese Date Strings

zhaozj2021-02-16  149

We usually need to write on the web page, which may use client script, or use ASP. One feature to use ASP is that the effect it produces looks a static page, but in fact it is dynamically generated. If you want to use ASP to display a Chinese date, you need to transform. Below is a function used to transform and its call example. <<<< function implementation >>>> <% '====================================== ================== Function Date2CHINESE 'function: get a string of Chinese dates (such as May 12, 1998)' parameters: iDate to translate the date 'Return: Chinese Date string' ========================================= ============= Function Date2Chinese (iDate) DIM NUM (10) DIM IYEAR DIM IMONTH DIM iDAY

Num (0) = "〇" NUM (1) = "1" NUM (2) = "II" 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 / 100) MOD 10) Num ((iodiear _ / 10) mod 10) NUM (Iyear Mod_ 10) "Year" if IMONTH> = 10 Then IF IMONTH = 10 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> = 10 Then if iDay = 10 Then Date2CHINESE = DATE2CHINESE _ "10" "Japanese" Elseif iDay = 20 or iday = 30 Then Date2CHINESE = DATE2CHINESE _ NUM (IDAY / 10) "Ten" "Day" Elseif iDay> 20 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 IFEND Function%> <<< Call Forwarding >>>> <% Response.write Date2CHINESE (Date ())%>

转载请注明原文地址:https://www.9cbs.com/read-8329.html

New Post(0)