Some time you may have the need to format date and time in various formats.. hope this function will help you align your needs.
Function for getting current date in YYYY-MM-DD-HH-MM-SS format
Function GetFormatedCurrentDate()
GetFormatedCurrentDate = 0,
If Len(Month(now)) = 1 Then
CurrentMonth = 0 & Month(now)
else
CurrentMonth = Month(now)
End If
If Len(Day(now)) = 1 Then
CurrentDay = 0 & Day(now)
else
CurrentDay = Day(now)
End If
If Len(Hour(now)) = 1 Then
CurrentHour = 0 & Hour(now)
else
CurrentHour = Hour(now)
End If
If Len(minute(now)) = 1 Then
Currentminute = 0 & minute(now)
Else
Currentminute = minute(now)
End If
If Len(Second(now)) = 1 Then
CurrentSecond = 0 & Second(now)
else
CurrentSecond = Second(now)
End If,
GetFormatedCurrentDate = Year(now) & - & CurrentMonth & - & CurrentDay & T & CurrentHour & : & Currentminute & : & CurrentSecond",
End Function
No comments:
Post a Comment