Display or change the date
Syntax
to display the date
DATE /T
to set the system date
DATE
or
DATE <date_today>
The output from DATE /T in the United States is "Mon 01/23/1997" 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.
The ISO standard 8601 defines a date and time format that can be used internationally: YYYY-MM-DD this avoids the confusion that is often caused by differences in language and local custom.
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
“Carpe Diem - Seize the day” ~ Horace
Related:
%DATE% - variable containing current Date.
GetDate.cmd - Get todays Date (any region, any OS)
datetime.vbs - Get Date, Time and daylight savings (VB Script)
NOW - Display Message with Current Date and Time
NET TIME - Display the Date in US Format (mm-dd-yy)
REG - Read, Set or Delete registry keys and values
TIME - Display or set the system time
TOUCH - Change file timestamps
PowerShell: Set-ADUser -Country - Change a users Country Code and other settings.
PowerShell: Set-Date - Change the computer system time
Equivalent bash command (Linux): date - Display or change the date