web analytics

How to format the date and time in vbscript

Options

codeling 1595 - 6639
@2018-06-27 12:06:05

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

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com