'************************************
'功能:获取当前年月日时分秒的连续数字字符串
'参数:无
'调用方式: ret = GetCurrentTime()
'返回值:返回年月日时分秒的连续数字字符串如:20130808080808
'作者:HF
'日期:2013-08-19
'************************************
Function GetCurrentTime()
Datetime = Now
Parameter = Array("yyyy","m","d","h","n","s")
For Each P In Parameter
Temp = DatePart(P,Datetime)
If Len(Temp) = 1 Then
Temp = "0"&Temp
End If
strTime = strTime & Temp
Next
GetCurrentTime = strTime
End Function
'-------------没有时分秒--------------
Function GetCurrentDate()
Datetime = date
Parameter = Array("yyyy","m","d")
For Each P In Parameter
Temp = DatePart(P,Datetime)
If Len(Temp) = 1 Then
Temp = "0"&Temp
End If
strTime = strTime & Temp
Next
GetCurrentTime = strTime
End Function
MsgBox GetCurrentTime()
转载于:https://www.cnblogs.com/hgfg331/p/4157670.html