echo %date% in format YYYY-MM-DD, windows command line

Here is direct link:

For example if you want to echo %date% in format yyyy-mm-dd then use:
for /f "tokens=*" %%d in ('"%~dp0date.exe" +%%Y-%%m-%%d') do (
echo %%d
)
date.exe must be side by side together with batch file

Documentations is pretty much the same as under the linux:https://linux.die.net/man/1/date

No comments: