fortypoundhead.com

DATE

Primary Category = Windows Commandline

Posted On 2007-01-01 by FortyPoundHead
Keywords: Command Reference
Tags: Windows Commandline Windows
Views: 1516
Rating: / 5.00

  • 1
  • 2
  • 3
  • 4
  • 5

 

Display or change the date

Syntax

to display the date

DATE /T

to set the system date

DATE

or

DATE

A typical output from DATE /T is "Mon 11/09/2000" but this is dependent on the country code. The date formats for different country codes are as follows:

Country or languageCountryCodeDate formatTime format
United States00101/23/19975:35:00.00p
Czechoslovakia04223.01.1997 17:35:00
France03323.01.1997 17:35:00
Germany04923.01.1997 17:35:00
Latin America00323/01/19975:35:00.00p
International English06123/01/1997 17:35:00.00
Portugal35123-01-1997 17:35:00
Finland35823.1.199717.35.00
Switzerland04123.01.97 17 35.00
Norway04723.01.97 17:35:00
Belgium03223/01/97 17:35:00
Brazil05523/01/97 17:35:00
Italy03923/01/97 17.35.00
United Kingdom04423/01/97 17:35:00.00
Denmark04523-01-97 17.35.00
Netherlands03123-01-97 17:35:00
Spain0343/12/9817:35:00
Hungary0361997.01.23 17:35:00
Canadian-French0021997-01-23 17:35:00
Poland0481997-01-23 17:35:00
Sweden0461997-01-23 17.35.00


Date Formatting

In Control Panel Regional settings a short date STYLE can be set. This can be used to change the date separator, the order (e.g. dd/mm/yyyy or mm/dd/yyyy) and the number of characters used to display days and months.

Date Format information in the registry

The Country Code is a setting in the registry. This can be read using REG.exe as follows

Note: following command is all on one line:

FOR /F "TOKENS=3 delims= " %%G IN ('REG QUERY "HKEY_CURRENT_USER\Control Panel\International\iCountry"') DO (SET v_country=%%G)

The date separator is also a registry setting. This can be read using REG.exe as follows

Note: following command is all on one line:

FOR /F "TOKENS=3 delims= " %%G IN ('REG QUERY "HKEY_CURRENT_USER\Control Panel\International\sDate"') DO SET v_date_sep=%%G

If Command Extensions are disabled DATE will not support the /T switch

About the Author

FortyPoundHead has posted a total of 1975 articles.

You can find more information from FortyPoundHead by visiting .

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:54.163.159.27

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