Output of "%date% %TIME%"

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Rosetta
Posts: 3
Joined: 24 Apr 2011 10:05

Output of "%date% %TIME%"

#1 Post by Rosetta » 24 Apr 2011 10:12

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?

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

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

#2 Post by nitt » 24 Apr 2011 12:15

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".

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

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

#3 Post by aGerman » 24 Apr 2011 12:35

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

Rosetta
Posts: 3
Joined: 24 Apr 2011 10:05

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

#4 Post by Rosetta » 24 Apr 2011 14:01

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]

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

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

#5 Post by aGerman » 24 Apr 2011 15:00

You could cut the last 3 characters using %time:~,-3%.

Regards
aGerman

Rosetta
Posts: 3
Joined: 24 Apr 2011 10:05

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

#6 Post by Rosetta » 25 Apr 2011 11:28

aGerman wrote:You could cut the last 3 characters using %time:~,-3%.

Regards
aGerman


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

phillid
Posts: 109
Joined: 03 Apr 2010 20:27
Location: Wellington, New Zealand
Contact:

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

#7 Post by phillid » 25 Apr 2011 18:01

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

shajanjp
Posts: 5
Joined: 28 Apr 2011 22:33

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

#8 Post by shajanjp » 28 Apr 2011 22:49

If you really want to get the time properly...
Just google for "command line date&time utility"...
:)

Post Reply