Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Edit date output

Status
Not open for further replies.

lpb71

Technical User
Mar 10, 2004
57
GB
How can I get a vb script to output the date and time into a ccyymmddhhmm format to a variable?

Thanks
 
I'd create this function:
Code:
Function myDateTime(dtVar)
myDateTime = Year(dtVar) & Right("0" & Month(dtVar), 2) & Right("0" & Day(dtVar), 2) _
             & Right("0" & Hour(dtVar), 2) & Right("0" & Minute(dtVar), 2) & Right("0" & Second(dtVar), 2)
End Function
and then:
MsgBox myDateTime(Now)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Just what I needed.

Many thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top