this is what i found
it works for me
set /a year=%date:~6,4%
if %date:~3,1% equ 0 (
set /a month=%date:~4,1%
) else set /a month=%date:~3,2%
if %date:~0,1% equ 0 (
set /a day=%date:~1,1%
) else set /a day=%date:~0,2%
if %time:~0,1% equ 0 (
set /a hours=%time:~1,1%
) else set /a hours=%time:~0,2%
if %time:~3,1% equ 0 (
set /a mins=%time:~4,1%
) else set /a mins=%time:~3,2%
if %time:~6,1% equ 0 (
set /a secs=%time:~7,1%
) else set /a secs=%time:~6,2%
----- Original Message -----
From: "John Tolmachoff (Lists)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 04, 2003 1:22 AM
Subject: [IMail Forum] OT: command line variable
> I have the following to be able to add the date to a file name, however I
> need to know how to also add the time.
>
> FOR /F "tokens=2" %%i IN ('date /t') DO SET thedate=%%i
> SET mm=%thedate:~0,2%
> SET dd=%thedate:~3,2%
> SET yyyy=%thedate:~6,4%
> )
>
> John Tolmachoff
> Engineer/Consultant/Owner
> eServices For You
>
>
>
>
> To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
> List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
> Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/
>
To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/