Posted On 2007-04-25 by FortyPoundHead
Keywords: Command Reference
Tags: Windows Commandline Windows
Views: 1519

Display or set the system time.

TIME [new_time]

new_time : The time as HH:MM

TIME with no parameters will display the current time and prompt
for a new value. Pressing ENTER will keep the same time.

/T : Just display the time, formatted according to the current Regional settings.Time Formatting

In Control Panel, Regional settings a Time Appearance can be set. This can be used to change the separator, and the number of characters used to display hours and minutes.

To display the time including Seconds:

ECHO.| TIME will display the time, including seconds and hundredths of a second

Time Format information in the Registry

The Country Code is a user setting in the registry:

[HKEY_CURRENT_USER\Control Panel\International]

The Country Code can be read using REG.exe as follows

FOR /F "TOKENS=2,3*" %%A IN (''REG QUERY "HKEY_CURRENT_USER\Control Panel\International\iCountry"'') DO (FOR %%G in (%%A) DO (SET _country=%%G)) The time separator is also a registry setting

[HKEY_CURRENT_USER\Control Panel\International]

The time separator can be read using REG.exe as follows

FOR /F "TOKENS=2,3*" %%A IN (''REG QUERY "HKEY_CURRENT_USER\Control Panel\International\sTime"'') DO (FOR %%G in (%%A) DO (SET _time_sep=%%G))The time formats for different country codes are as follows:

Country or language CountryCode Date format Time format

United States 001 01/03/1994 5:35:00.00p

Czechoslovakia 042 03.01.1994 17:35:00
France 033 03.01.1994 17:35:00
Germany 049 03.01.1994 17:35:00
Latin America 003 03/01/1994 5:35:00.00p
International English 061 03/01/1994 17:35:00.00
Portugal 351 03-01-1994 17:35:00
Finland 358 3.1.1994 17.35.00
Switzerland 041 03.01.94 17 35.00
Norway 047 03.01.94 17:35:00
Belgium 032 03/01/94 17:35:00
Brazil 055 03/01/94 17:35:00
Italy 039 03/01/94 17.35.00
United Kingdom 044 03/01/94 17:35:00.00
Denmark 045 03-01-94 17.35.00
Netherlands 031 03-01-94 17:35:00
Spain 034 3/01/94 17:35:00
Hungary 036 1994.01.03 17:35:00
Canadian-French 002 1994-01-03 17:35:00
Poland 048 1994-01-03 17:35:00
Sweden 046 1994-01-03 17.35.00
If Command Extensions are disabled TIME will not support the /T switch

About the Author

FortyPoundHead has posted a total of 1974 articles.

Comments On This Post

No comments on this post yet!

Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.

Your IP address is:

Before you can post, you need to prove you are human. If you log in, this test goes away.

Code Links