How to format the date and time in vbscript Options

codeling Posts: 1089 Points: 4569
Posted: Wednesday, June 27, 2018 12:06:05 PM

The following code shows how to format the date and time in vbscript.

 

Dim TestStr

Dim date

date= now()

 

TestStr = year(date) & month(date) &  Right("0" & Day(date),2) & Right("0" & Hour(date),2) & Right("0" & Minute(date),2) & Right("0" & Second(date),2) & ".dat"

 

 

WScript.Echo TestStr

 
Users browsing this topic
Guest