Dec 11, 2003 #1 loloman Technical User Oct 30, 2002 16 FR how to transform date/t and time/t in .bat ex : for date : 12/10/2003 in 12102003 for time 12:33:00 in 123300
how to transform date/t and time/t in .bat ex : for date : 12/10/2003 in 12102003 for time 12:33:00 in 123300
Dec 11, 2003 1 #2 wallst32 MIS Apr 14, 2003 545 US This will give you the date in the format you requested: for /f "tokens=1-2" %%a in ('date /t') do ( set day=%%a set date=%%b) for /f "tokens=1-3 delims=/" %%a in ("%date%" do ( set m=%%a set d=%%b set y=%%c) set date1=%m%%d%%y% echo %date1% Note sure about the time though, since "time/t" gives you "12:33P" as the output. Upvote 0 Downvote
This will give you the date in the format you requested: for /f "tokens=1-2" %%a in ('date /t') do ( set day=%%a set date=%%b) for /f "tokens=1-3 delims=/" %%a in ("%date%" do ( set m=%%a set d=%%b set y=%%c) set date1=%m%%d%%y% echo %date1% Note sure about the time though, since "time/t" gives you "12:33P" as the output.
Dec 11, 2003 #3 jdeane IS-IT--Management Sep 21, 2001 229 GB ------------------ for /F "tokens=1,2,3,4 delims=/ " %%i in ('date/t') do set d=%%i-%%j-%%k for /F "tokens=1,2 delims=:" %%a in ('time/t') do set t=%%a-%%b echo %d% echo %t% ------------------ this is what I use in a batch file to copy and rename files so that they get a date and time stamp. Jonathan Upvote 0 Downvote
------------------ for /F "tokens=1,2,3,4 delims=/ " %%i in ('date/t') do set d=%%i-%%j-%%k for /F "tokens=1,2 delims=:" %%a in ('time/t') do set t=%%a-%%b echo %d% echo %t% ------------------ this is what I use in a batch file to copy and rename files so that they get a date and time stamp. Jonathan