‘’将一个一位的数字前面加零
function FillZero(str)
ttt=str
if len(str)=1 then
ttt="0" & str
end if
FillZero=ttt
end function
‘’转化日期,将 一位补上零 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
‘’输入一个日期时间串,转换成年四位,其他两位的新的日期时间串
function ConvertDateTime(tDateTime)
ttt=tDateTime
if isdate(tDateTime) then
ttt=year(tDateTime) & "-" & FillZero(month(tDateTime)) & "-" & FillZero(day(tDateTime)) & " " & FillZero(cstr(hour(tDateTime))) & ":" & FillZero(cstr(minute(tDateTime))) & ":" & FillZero(cstr(second(tDateTime)))
end if
ConvertDateTime=ttt
end function