Page 1 of 1

Output of "%date% %TIME%"

Posted: 24 Apr 2011 10:12
by Rosetta
Hi,

When i use "%date% %TIME%" in my bat-file the output is like this:

2011-04-24 18:14:39,83

What does "83" mean? How kan i change in "%date% %TIME%" so that i don have the number in the output?

Re: Output of "%date% %TIME%"

Posted: 24 Apr 2011 12:15
by nitt
Rosetta wrote:Hi,

When i use "%date% %TIME%" in my bat-file the output is like this:

2011-04-24 18:14:39,83

What does "83" mean? How kan i change in "%date% %TIME%" so that i don have the number in the output?


It's "18:14:39.83". It's a "." not a ",". It just means centiseconds.

To output the time without that use TIME /T. You'll get something like "02:15 PM".

Re: Output of "%date% %TIME%"

Posted: 24 Apr 2011 12:35
by aGerman
nitt

For me it's also a comma (there are different decimal separators in different counties/languages). It depends on the "international" settings in your registry ...

Regards
aGerman

Re: Output of "%date% %TIME%"

Posted: 24 Apr 2011 14:01
by Rosetta
nitt wrote:
Rosetta wrote:Hi,

When i use "%date% %TIME%" in my bat-file the output is like this:

2011-04-24 18:14:39,83

What does "83" mean? How kan i change in "%date% %TIME%" so that i don have the number in the output?


It's "18:14:39.83". It's a "." not a ",". It just means centiseconds.

To output the time without that use TIME /T. You'll get something like "02:15 PM".



THANX nitt, for ur help but it did not change the output. The code is:

echo The file was copied at: %date% %TIME% >> MyLog.log

And i tested the followings:

echo The file was copied at: %date% %TIME/T.% >> MyLog.log
echo The file was copied at: %date% %TIME/T% >> MyLog.log
echo The file was copied at: %date% %TIME%/T. >> MyLog.log
echo The file was copied at: %date% %TIME% /T >> MyLog.log
echo The file was copied at: %date% TIME /T. >> MyLog.log


But none of them changed the output. How did you mean the code shuld be?[/quote]

Re: Output of "%date% %TIME%"

Posted: 24 Apr 2011 15:00
by aGerman
You could cut the last 3 characters using %time:~,-3%.

Regards
aGerman

Re: Output of "%date% %TIME%"

Posted: 25 Apr 2011 11:28
by Rosetta
aGerman wrote:You could cut the last 3 characters using %time:~,-3%.

Regards
aGerman


GREATE aGerman! It works! THANX a lot! :)

Re: Output of "%date% %TIME%"

Posted: 25 Apr 2011 18:01
by phillid
aGerman wrote:For me it's also a comma (there are different decimal separators in different counties/languages). It depends on the "international" settings in your registry ...

I've never understood why the Euopeans use a comma as a decimal point... People over here in New Zealand confuse foriegn people when they use a comma like: 1,000,000

Oh well, it's off topic anyways :D

phillid

Re: Output of "%date% %TIME%"

Posted: 28 Apr 2011 22:49
by shajanjp
If you really want to get the time properly...
Just google for "command line date&time utility"...
:)