Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Time Format

46 views
Skip to first unread message

Frank P. Westlake

unread,
Dec 18, 2009, 11:03:02 AM12/18/09
to
It seems to me from experiments on my system that TIME/T uses the
regional setting and that TIME and %TIME% both use a fixed format. Does
anyone have something other than H:MM:SS.ms for TIME and %TIME%?
Examples:

Echo.%TIME%
7:48:43.96

Note the space before '7' both above and below.

Echo.|TIME
The current time is: 7:48:44.05
Enter the new time:

The following with regional time setting of hh:mm:ss tt. Note that '7'
is preceded by '0' instead of space.

TIME /T
07:49 AM

The regional time setting can be changed with
'%SystemRoot%\System32\intl.cpl', "Customize this format..." button,
"Time" tab.

Frank


foxidrive

unread,
Dec 18, 2009, 11:54:42 AM12/18/09
to
On Fri, 18 Dec 2009 08:03:02 -0800, "Frank P. Westlake"
<frank.w...@gmail.com> wrote:

>It seems to me from experiments on my system that TIME/T uses the
>regional setting and that TIME and %TIME% both use a fixed format. Does
>anyone have something other than H:MM:SS.ms for TIME and %TIME%?
>Examples:
>
> Echo.%TIME%
> 7:48:43.96
>
>Note the space before '7' both above and below.
>
> Echo.|TIME
> The current time is: 7:48:44.05
> Enter the new time:
>
>The following with regional time setting of hh:mm:ss tt. Note that '7'
>is preceded by '0' instead of space.
>
> TIME /T
> 07:49 AM
>

I confirm that the leading space in the first two and the time /t takes the
regional system applet variable.

D:\>echo %time%
3:48:04.85

D:\>time
The current time is: 3:48:10.60
Enter the new time:

D:\>time /t
03:48


But the regional system applet can change the time separator (to 'a' for
example) and this is what happens:


D:\>echo %time%
3a51a15.95

D:\>time
The current time is: 3a51a24.42
Enter the new time:

D:\>time /t
03a51

Frank P. Westlake

unread,
Dec 18, 2009, 12:11:02 PM12/18/09
to
"foxidrive" news:3kcni5t4vhor0c77i...@4ax.com...

> But the regional system applet can change the time separator (to 'a'
> for

> example) ...

Thank you. I tried repositioning the time values (i.e ss:mm:HH, which
worked for TIME/T but not for the others) but I didn't think of changing
the seperator.

It is far too soon to say with any confidence (since no one else has
replied) but are you (or anyone else) aware of anything which suggests
that %TIME% and 'TIME' do not use a fixed format internationally? You've
shown that we cannot use the seperator as a delimiter but we can still
use positions within the string (i.e. %TIME:~0,5%).

The format of 'DATE/T', 'DATE', and %DATE% can all be changed through
the regional settings applet (or the Registry directly) but it would
still be convenient if we knew that %TIME% and 'TIME' have a fixed
format.

Frank


John Gray

unread,
Dec 18, 2009, 1:54:57 PM12/18/09
to
On 18 Dec, 17:11, "Frank P. Westlake" <frank.westl...@gmail.com>
wrote:

In 2001 I worked out all the date and time formats for the 78-odd
possible International/Regional Settings that we are given in the UK,
all the way from Afrikaans to Uzbek (Latin) for
DATE /T
TIME /T
DATE
TIME
NET TIME
DIR of files with am and pm modified times

e.g. (with we could do a fixed-format font...)

Faroese
DATE /T dd-mm-yyyy dd-mm-yyyy
TIME /T hh.mm hh.mm
DATE The current date is: dd-mm-yyyy dd-mm-yyyy
TIME The current time is: h.mm.ss,th h.mm.ss,th
Current time at \\pcname is m/d/yyyy h:mm AM m/d/yyyy h:mm
PM
DIR of AM-file and PM-file dd-mm-yyyy hh.mm dd-mm-yyyy
hh.mm (24h)

Not sure how much of this would be any use to you?
For TIME, the only two formats appear to be h:mm:ss.th and h:mm:ss,th
(final separator: full stop or comma).

Matt Williamson

unread,
Dec 18, 2009, 2:27:47 PM12/18/09
to

The same here on Windows 7 RC 64bit and WinXP Pro boxes


Microsoft Windows [Version 6.1.7100]
%time%=14:22:27.23
time=The current time is: 14:22:27.25
Enter the new time:
time/t=02:22 PM

International Settings in Registry

HKEY_CURRENT_USER\Control Panel\International
Locale REG_SZ 00000409
LocaleName REG_SZ en-US
s1159 REG_SZ AM
s2359 REG_SZ PM
sCountry REG_SZ United States
sCurrency REG_SZ $
sDate REG_SZ /
sDecimal REG_SZ .
sGrouping REG_SZ 3;0
sLanguage REG_SZ ENU
sList REG_SZ ,
sLongDate REG_SZ dddd, MMMM dd, yyyy
sMonDecimalSep REG_SZ .
sMonGrouping REG_SZ 3;0
sMonThousandSep REG_SZ ,
sNativeDigits REG_SZ 0123456789
sNegativeSign REG_SZ -
sPositiveSign REG_SZ
sShortDate REG_SZ M/d/yyyy
sThousand REG_SZ ,
sTime REG_SZ a
sTimeFormat REG_SZ h:mm:ss tt
sShortTime REG_SZ h:mm tt
sYearMonth REG_SZ MMMM, yyyy
iCalendarType REG_SZ 1
iCountry REG_SZ 1
iCurrDigits REG_SZ 2
iCurrency REG_SZ 0
iDate REG_SZ 0
iDigits REG_SZ 2
NumShape REG_SZ 1
iFirstDayOfWeek REG_SZ 6
iFirstWeekOfYear REG_SZ 0
iLZero REG_SZ 1
iMeasure REG_SZ 1
iNegCurr REG_SZ 0
iNegNumber REG_SZ 1
iPaperSize REG_SZ 1
iTime REG_SZ 0
iTimePrefix REG_SZ 0
iTLZero REG_SZ 0


Microsoft Windows XP [Version 5.1.2600]
%time%=14:19:04.96
time=The current time is: 14:19:05.16
Enter the new time:
time/t=02:19 PM

International Settings in Registry

! REG.EXE VERSION 3.0

HKEY_CURRENT_USER\Control Panel\International
Locale REG_SZ 00000409
sLanguage REG_SZ ENU
sCountry REG_SZ United States
iCountry REG_SZ 1
sList REG_SZ ,
iMeasure REG_SZ 1
sDecimal REG_SZ .
sThousand REG_SZ ,
iDigits REG_SZ 2
iLZero REG_SZ 1
sCurrency REG_SZ $
iCurrDigits REG_SZ 2
iCurrency REG_SZ 0
iNegCurr REG_SZ 0
sDate REG_SZ
sTime REG_SZ :
sShortDate REG_SZ ddd MM/dd/yyyy
sLongDate REG_SZ dddd, MMMM dd, yyyy
iDate REG_SZ 1
iTime REG_SZ 0
iTLZero REG_SZ 0
s1159 REG_SZ AM
s2359 REG_SZ PM
iCalendarType REG_SZ 1
sTimeFormat REG_SZ h:mm:ss tt
iTimePrefix REG_SZ 0
sMonDecimalSep REG_SZ .
sMonThousandSep REG_SZ ,
iNegNumber REG_SZ 1
sNativeDigits REG_SZ 0123456789
NumShape REG_SZ 1
iFirstDayOfWeek REG_SZ 6
iFirstWeekOfYear REG_SZ 0
sGrouping REG_SZ 3;0
sMonGrouping REG_SZ 3;0
sPositiveSign REG_SZ
sNegativeSign REG_SZ -

Frank P. Westlake

unread,
Dec 18, 2009, 2:43:17 PM12/18/09
to
"John Gray"
news:d19730e6-d214-4ca2...@b2g2000yqi.googlegroups.com...

> Not sure how much of this would be any use to you?

Not just me; all of us.

> For TIME, the only two formats appear to be h:mm:ss.th and h:mm:ss,th
> (final separator: full stop or comma).

Thank you John, that is what I was hoping for. It makes standardization
of the time routines much easier. We can use "tokens=1-4 delims=:.,",
take 'h' directly and not worry about a preceding 0, and do "x=1%%x-100"
for minutes, seconds, and hundredths.

I also hope it is the same for the TIME variable. The variable and the
command 'TIME' seem to be the same so far.

Too bad it isn't so easy for date.

Frank


Todd Vargo

unread,
Dec 18, 2009, 5:49:57 PM12/18/09
to
foxidrive wrote:

FWIW, I get the same output as foxidrive with win95cmd in Windows 98. Also,
I notice that changes made in regional settings do not take effect on any
open cmd sessions. Only new cmd sessions opened after a regional setting
change will display the new format. I don't know if other OSes behave the
same way though.

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

foxidrive

unread,
Dec 19, 2009, 7:02:02 AM12/19/09
to
On Fri, 18 Dec 2009 17:49:57 -0500, "Todd Vargo" <tlv...@sbcglobal.netz>
wrote:

>> But the regional system applet can change the time separator (to 'a' for
>> example) and this is what happens:
>>
>>
>> D:\>echo %time%
>> 3a51a15.95
>>
>> D:\>time
>> The current time is: 3a51a24.42
>> Enter the new time:
>>
>> D:\>time /t
>> 03a51
>
>FWIW, I get the same output as foxidrive with win95cmd in Windows 98. Also,
>I notice that changes made in regional settings do not take effect on any
>open cmd sessions. Only new cmd sessions opened after a regional setting
>change will display the new format. I don't know if other OSes behave the
>same way though.

FWIW I changed the 'a' separater back to ':' and noted that it changed in
the cmd window that was already open. That's in XP Pro SP3

Frank P. Westlake

unread,
Dec 19, 2009, 8:39:12 AM12/19/09
to
"foxidrive" news:m2gpi5lmrliofv3fp...@4ax.com...

> That's in XP Pro SP3

Changes are also immediate in Windows Vista.

Frank


Todd Vargo

unread,
Dec 20, 2009, 10:40:35 AM12/20/09
to

Thanks. I expected cmd's native OS would have immediate update.

Frank P. Westlake

unread,
Jan 29, 2010, 11:17:44 AM1/29/10
to
"foxidrive" news:3kcni5t4vhor0c77i...@4ax.com...

> But the regional system applet can change the time separator (to 'a'
> for

> example) ...

Is that Windows XP? I just went through every keyboard character on
Windows Vista and these are the only characters INTL.CPL accepts (8
characters between quotes): ":/\;,.- ".

I vaguely recall (not certain though) what you state to be true for NT4.

Frank


foxidrive

unread,
Jan 29, 2010, 11:27:50 AM1/29/10
to

Yes Frank, it's XP pro SP3.


--
Regards,
Mic

0 new messages