Convert a Arab Digital Date to Chinese Digital Date Format (ASP)

xiaoxiao2021-03-06  76

I just saw a brother's question, I finished it, I found that I have born, depressed ~~

Just see this thing is still useful, so I'm coming out from the reward.

Idea:

At the beginning, I thought I used Select to convert each Arabic number into a corresponding Chinese with a for loop, and then I thought that I can use an array. This is less code. After all, 0 ~ 9, you can correspond to it, but ~ the problem, for 10 ~ 31, to become "壹" such a format, huh, add a judgment, um ~ 11 can not be converted into "", add judgment

Ha ha ~ Basic good, you need to judge whether it is a number, OK! This should be OVER!

<%

T = now ()

Function datetostr (t)

Dim Stryear, Strmonth, StRDAY, STRESULT

Stryear = year (t)

Strmonth = month (t)

strDay = day (t)

DateTostr = Casei (Stryear) & "Year" & Casei (Strmonth) & "Month" & Casei (STRDAY) & "Japan"

END FUNCTION

Function Casei (i)

DIM Arrnum, Arrcnnum

IF (ISNUMERIC (i)) THEN

Arrnum = Split (i)

Arrcnnum = split ("zero,,, 叁,,, land, 柒, 捌, 玖, 玖,", ")

IF (i <10 or i> 31) THEN

For it = 1 to Len (i)

Strresult = Strresult & Arrcnnum (CINT (MID (I, IT, 1))))

NEXT

Elseif (i> 9 and i <12) THEN

Strresult = "Pick up" & ArrcnnUM (CINT (MID (I, 2, 1)))))

Else

Strresult = ArrcnNUM (CINT (MID (I, 1, 1))) & "Pick" & ArrcnnUM (CINT (MID (I, 2, 1)))

END IF

END IF

Casei = Strresult

END FUNCTION

Response.write (DateTostr (T))

%>

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

New Post(0)