function <%
'----Date conversion function-----
function Wf_datetochar (datetime,l)
'---------explain------------
' DateTime is the date value you want to convert
' L is the level you want to convert to, and can be set to ' d ', ' n ' and ' s '
' d ' refers to the conversion of the Yyyy-mm-dd form
"N" refers to the conversion of YYYY-MM-DD hh:mm form
' "s" refers to the conversion of YYYY-MM-DD hh:mm:ss form
' Long ' is the form that translates into the yyyy year mm month DD Day
' No ' refers to the form of conversion to YYYYMMDD
' Short ' refers to the form of conversion to YYMMDD
' t ' refers to the form of conversion to YYMMDD hh:mm
'-------------------------
Dim ls_date,ls_getstr
If IsNull (l) or trim (l) = "" Then l= "s"
If IsDate (datetime) Then
LS_DATE=CSTR (DateTime)
' Writeln ls_date
Ls_getstr=datepart ("yyyy", CDate (ls_date))
Ls_getstr=ls_getstr & "-" & Wf_ctonstr (DatePart ("M", CDate (Ls_date)), 2)
Ls_getstr=ls_getstr & "-" & Wf_ctonstr (DatePart ("D", CDate (Ls_date)), 2)
If l= "D" then wf_datetochar=ls_getstr
Ls_getstr=ls_getstr & "" & Wf_ctonstr (DatePart ("H", CDate (Ls_date)), 2
Ls_getstr=ls_getstr & ":" & Wf_ctonstr (DatePart ("N", CDate (Ls_date)), 2)
If l= "n" then Wf_datetochar=ls_getstr
Ls_getstr=ls_getstr & ":" & Wf_ctonstr (DatePart ("s", CDate (Ls_date)), 2)
If l= "s" then wf_datetochar=ls_getstr
If l= "Long" then Wf_datetochar=datepart ("yyyy", CDate (ls_date)) & "Year" &wf_ctonstr (DatePart ("M", CDate (Ls_date) ), 2 & "Month" &wf_ctonstr (DatePart ("D", CDate (Ls_date)), 2) & "Day"
If l= "No" then Wf_datetochar=datepart ("yyyy", CDate (ls_date)) &wf_ctonstr (DatePart ("M", CDate (Ls_date)), 2 & Wf_ctonstr (DatePart ("D", CDate (Ls_date)), 2)
If l= "short" then Wf_datetochar=right (DatePart ("yyyy", CDate (Ls_date)), 2) &wf_ctonstr (DatePart ("M", CDate (Ls_ Date)), 2) &wf_ctonstr (DatePart ("D", CDate (Ls_date)), 2)
If l= "T" then Wf_datetochar=wf_ctonstr (DatePart ("M", CDate (Ls_date)), 2 &wf_ctonstr (DatePart ("D", CDate (Ls_date) ), 2 & "" & Wf_ctonstr (DatePart ("H", CDate (Ls_date)), 2) & ":" & Wf_ctonstr (DatePart ("N", CDate (ls_date)) , 2)
Else
Wf_datetochar=null
End If
End Function
'----Converts an integer to a two-bit integer----"1" to "01"
function Wf_ctonstr (num,n)
If not isnumeric (num) Then
Wf_ctonstr=num
Else
If Len (CInt (num)) >=n Then
WF_CTONSTR=CSTR (CInt (num))
Else
Wf_ctonstr= "0" &cstr (CInt (num))
While Len (WF_CTONSTR) <n
Wf_ctonstr= "0" &cstr (WF_CTONSTR)
Wend
End If
End If
End Function
'-----------------------------------
%>