Functions | We sometimes encounter the date format may be 2004-1-12, the system automatically removed the month of 0, but sometimes we need the full date format, such as: 2004-01-12 so what to do? Some of the following functions can be easily handled.
' Put one digit in front of 0
function Fillzero (str)
Ttt=str
If Len (str) =1 Then
ttt= "0" & Str
End If
Fillzero=ttt
End Function
' Conversion date, will be a complement to zero 2003-1-2--> 2003-01-02
function Convertdate (tdate)
Ttt=tdate
If IsDate (tdate) Then
Ttt=year (tdate) & "-" & Fillzero (Month (tdate)) & "-" & Fillzero (Day (tdate))
End If
Convertdate=ttt
End Function
' Enter a date-time string to convert the adult four-bit, the other two-bit new date-time string
function Convertdatetime (tdatetime)
Ttt=tdatetime
If IsDate (tdatetime) Then
Ttt=year (tdatetime) & "-" & Fillzero (Month (tdatetime)) & "-" & Fillzero (Day (tdatetime)) & "" & Fi Llzero (CStr (Hour (tdatetime)) & ":" & Fillzero (CStr (Minute (tdatetime)) & ":" & Fillzero (CStr) (second ( Tdatetime)))
End If
Convertdatetime=ttt
End Function