Format Date In Batch File
Nice script for formatting dates in a batch file without having the system locale settings impact your format
Copy this code and paste it in your HTML
for /f "skip=1 tokens=1-6 delims= "
%%a in ('wmic path Win32_LocalTime Get Day
^,Hour
^,Minute
^,Month
^,Second
^,Year /Format:table'
) do ( set /a FormattedDate=10000 *
%%f + 100 *
%%d +
%%a set FormattedDate=
!FormattedDate:~-2,2!/!FormattedDate:~-4,2!/!FormattedDate:~-6,2! )
)
URL: http://stackoverflow.com/questions/14427490/how-to-set-date-from-cmd-after-retrieving-it/14435810#14435810
Report this snippet
Comments
Subscribe to comments