Help with a Time script

  • Thread starter Thread starter ajmister
  • Start date Start date
A

ajmister

Hi

If I run the following command before noon (9 am) set
filename=%Date:~-4,4%%Date:~-10,2%%Date:~-7,2%_%Time:~0,2%%Time:~3,2%
it gives me 20040225_ 901. if I run after noon (3:15 pm) it gives me
20040225_1515. Is there away to include the 0 before the _ 901 time stamp.

Does some one have a solution.

Thank you
Ajay
 
Thank you.

Ajay
Phil Robyn said:
filename=%Date:~-4,4%%Date:~-10,2%%Date:~-7,2%_%Time:~0,2%%Time:~3,2%
set filename=%filename: =0%


--
Phil Robyn
Univ. of California, Berkeley

u n z i p m y a d d r e s s t o s e n d e - m a i l
 
Hi

If I run the following command before noon (9 am) set
filename=%Date:~-4,4%%Date:~-10,2%%Date:~-7,2%_%Time:~0,2%%Time:~3,2%
it gives me 20040225_ 901. if I run after noon (3:15 pm) it gives me
20040225_1515. Is there away to include the 0 before the _ 901 time stamp.

Does some one have a solution.

How about:

REM replace any spaces in %TIME% with 0 (should only occur at the
left-most position)
set fulltime=%time: =0%
set filename=%Date:~-4,4%%Date:~-10,2%%Date:~-7,2%_%fulltime:~0,2%%
fullime:~3,2%

ws
 
ajmister said:
Hi

If I run the following command before noon (9 am) set
filename=%Date:~-4,4%%Date:~-10,2%%Date:~-7,2%_%Time:~0,2%%Time:~3,2%
it gives me 20040225_ 901. if I run after noon (3:15 pm) it gives me
20040225_1515. Is there away to include the 0 before the _ 901 time stamp.

Does some one have a solution.

Thank you
Ajay

filename=%Date:~-4,4%%Date:~-10,2%%Date:~-7,2%_%Time:~0,2%%Time:~3,2%
set filename=%filename: =0%
 
In said:
Hi

If I run the following command before noon (9 am) set
filename=%Date:~-4,4%%Date:~-10,2%%Date:~-7,2%_%Time:~0,2%%Time:~3,
2% it gives me 20040225_ 901. if I run after noon (3:15 pm) it
gives me 20040225_1515. Is there away to include the 0 before the
_ 901 time stamp.

One solution is to change the "International Settings" (Regional
settings) for Date and Time Format for the account or system you are
using. If that is feasible and desired of course.

2004-02-25 18:56:46
 
Back
Top