date format change

October 31, 2011 at 02:05:15
Specs: Windows XP
i have this code
SET date="%date:~10,4%-%date:~4,2%-%date:~7,2%"

YYYY-MM-DD.

but i want

set date
dd-mm-yyyy


See More: date format change

Report •


#1
October 31, 2011 at 07:40:27
Hi
Just alter the format as below
It,s not good practice to change the %date% variable as it's used by the system.


@echo off
xDate=%Date%
SET Zdate="%xdate:~10,4%-%xdate:~4,2%-%xdate:~7,2%"
SET Zdate="%xdate:~4,2%-%xdate:~7,2%-%xdate:~10,4%"
echo %zdate%



Report •
Related Solutions


Ask Question