How-to: Get the current date [getdate.vbs]

Return the current Year/Month/Day and Time formatted as a string.

' Syntax:
'  CSCRIPT /nologo getdate.vbs
Dim dt
'output format: yyyymmddHHnn
wscript.echox ((year(dt)*100 + month(dt))*100 + day(dt))*10000 + hour(dt)*100 + minute(dt)


C:\demo> CSCRIPT /nologo getdate.vbs
C:\demo> 201307081735

“If future generations are to remember us with gratitude rather than contempt, we must leave them more than the miracles of technology. We must leave them a glimpse of the world as it was in the beginning, not just after we got through with it” ~ President Lyndon B. Johnson

Related VBScript commands

GetDate.cmd - Get todays date Windows batch file.
datetime.vbs - Get Date, Time and Daylight savings.
Easter.vbs - Function to calculate the date of Easter.

Copyright © 1999-2024
Some rights reserved