Display or set the system time.
Syntax TIME [new_time]
TIME /T key 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.
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
The time separator and the Country Code are user settings in the registry:
The time separator can be read using REG as follows@echo off FOR /F "TOKENS=3" %%D IN ('REG QUERY ^"HKEY_CURRENT_USER\Control Panel\International^" /v sTime ^| find ^"REG_SZ^"') DO ( SET _time_sep=%%D) echo %_time_sep%
To read the Country Code replace sTime in the above with iCountry.
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 the time was successfully changed (or not given) %ERRORLEVEL% = 0
If the user lacks admin privileges = 1
TIME is an internal command. If Command Extensions are disabled TIME will not support the /T switch
“Time is like money, the less we have of it to spare, the further we make it go” - Josh Billings
%TIME% - variable containing current time
DATE - Display or change the date
NOW - Display Message with Current Date and Time
W32TM - Time Service
TZUTIL - Time Zone Utility
Timethis - Time how long it takes the system to run a command. (Win 2K ResKit)
Uptime - Time since last reboot. (Win 2K ResKit)
GetTime.cmd - Script to get current time
GMT.cmd - Current time in GMT (World Time)
Q307938 - Change Date and Time display y-M-d or yy-MM-dd or hh or HH (leading zeros/24 hour time)
Powershell: Get-Date - Get current date and time
Equivalent bash command (Linux): date - Display or change the date & time