TIME – Windows CMD Command
Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118
Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119
Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118
Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119
Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118
Notice: A non well formed numeric value encountered in /home/future4tech/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119
Display or set the system time.
1 2 3 4 5 6 7 8 9 |
Syntax TIME [new_time] 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.
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 and Hundredths of a second:ECHO:| TIME
The time Separator, Country Code and Time format can be read from the registry using REG as follows:
1 2 3 4 5 6 7 8 9 10 11 12 |
@Echo off FOR /F "TOKENS=3" %%D IN ('REG QUERY ^"HKEY_CURRENT_USER\Control Panel\International^" /v iCountry ^| find ^"REG_SZ^"') DO ( SET _country_code=%%D) Echo Country Code %_country_code% 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 Separator %_time_sep% FOR /F "TOKENS=3" %%D IN ('REG QUERY ^"HKEY_CURRENT_USER\Control Panel\International^" /v sTimeFormat ^| find ^"REG_SZ^"') DO ( SET _time_format=%%D) Echo Format %_time_format% |
Country Codes/Formats
The default time formats for different country codes are below.
Thses values are user changeable so it is not safe to assue the default will be correct for any particular user.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
Country/language Date format Time format Country Code United States MM/dd/yyyy H:mm:ss.tt 001 Czechoslovakia dd.MM.yyyy HH:mm:ss 042 France dd.MM.yyyy HH:mm:ss 033 Germany dd.MM.yyyy HH:mm:ss 049 Latin America dd/MM/yyyy H:mm:ss.tt 003 Intl. English dd/MM/yyyy HH:mm:ss.tt 061 Portugal dd-MM-yyyy HH:mm:ss 351 Finland d.M.yyyy HH.mm.ss 358 Switzerland dd.MM.yy HH mm.ss 041 Norway dd.MM.yy HH:mm:ss 047 Belgium dd/MM/yy HH:mm:ss 032 Brazil dd/MM/yy HH:mm:ss 055 Italy dd/MM/yy HH.mm.ss 039 United Kingdom dd/MM/yy HH:mm:ss 044 Denmark dd-MM-yy HH.mm.ss 045 Netherlands dd-MM-yy HH:mm:ss 031 Spain d/MM/yy HH:mm:ss 034 Hungary yyyy.MM.dd HH:mm:ss 036 Canadian-French yyyy-MM-dd HH:mm:ss 002 Poland yyyy-MM-dd HH:mm:ss 048 Sweden yyyy-MM-dd HH.mm.ss 046 yyyy = 4 digit year yy = 2 digit year dd = 2 digit day d = 1/2 digit day HH = 2 digit Hour H = 1/2 digit hour mm = 2 digit minutes ss = 2 digit seconds tt = AM/PM indicator t = a/p indicator |
Errorlevels
If the time was successfully changed (or not given) %ERRORLEVEL% = 0
If it fails, e.g. the user lacks the privilege %ERRORLEVEL% = 1
TIME is an internal command. If Command Extensions are disabled TIME will not support the /T switch
It is really a nice and helpful piece of information. I am glad that you shared this useful info with us. Please stay us up to date like this. Thank you for sharing.