-
Notifications
You must be signed in to change notification settings - Fork 4
datetime
Vurdalakov edited this page Feb 24, 2015
·
1 revision
datetime
command-line tool prints date and/or time in specified format.
datetime [/options]
/format
option sets the date and/or time output format. See here for details.
/adddays
option adds the specified number of days to the current date. The number of days can be negative or positive.
/newline
option adds a new line (CRLF) after output.
datetime
datetime /format:"dd.MM.yyyy HH.mm.ss.ffff"
datetime /adddays:-1 /format:yyyyMMdd
datetime /newline
Usage in .BAT files:
for /f "usebackq" %%i in (`datetime.exe /adddays:-1 /format:yyyy-MM-dd`) do set date=%%i
echo %date%