Error DataBase-One Place all Solutions Forums Blog Glossary    Contact Us
Search  
   
Browse by Category
Error DataBase-One Place all Solutions .: Operating Systems .: Windows Operating Systems .: MS DOS .: How to Display or set the date using DATE command

How to Display or set the date using DATE command

Display or change the date

Syntax

to display the date   
      DATE /T

to set the system date
      DATE
or
      DATE <date_today>

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 language   CountryCode  Date format Time format

United States 001 01/23/1997 5:35:00.00p
Czechoslovakia 042 23.01.1997 17:35:00 France 033 23.01.1997 17:35:00
Germany 049 23.01.1997 17:35:00
Latin America 003 23/01/1997 5:35:00.00p International English 061 23/01/1997 17:35:00.00
Portugal 351 23-01-1997 17:35:00
Finland 358 23.1.1997 17.35.00

Switzerland 041 23.01.97 17 35.00 Norway 047 23.01.97 17:35:00
Belgium 032 23/01/97 17:35:00 Brazil 055 23/01/97 17:35:00
Italy 039 23/01/97 17.35.00 United Kingdom 044 23/01/97 17:35:00.00

Denmark 045 23-01-97 17.35.00
Netherlands 031 23-01-97 17:35:00
Spain 034 3/12/98 17:35:00
Hungary 036 1997.01.23 17:35:00
Canadian-French 002 1997-01-23 17:35:00 Poland 048 1997-01-23 17:35:00
Sweden 046 1997-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

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

The date separator is also a registry setting

This can be read using REG.exe as follows

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

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


How helpful was this article to you?

Related Articles

article How to Configure Time and Date Settings in Windows 2008 Server Core
Windows Server 2008 has an interesting...

(No rating)  3-26-2008    Views: 197   
article How to Create logtime.txt and adds the date, time and a message using LOGTIME.EXE
Create logtime.txt and adds the date, time...

(No rating)  3-9-2008    Views: 121   
article How to Display messages on screen, turn command-echo on or off using ECHO Command
Display messages on screen, turn...

(No rating)  3-7-2008    Views: 329   

User Comments

Add Comment
No comments have been posted.