TIME (command)
In the realm of computing, the TIME command serves to both show and modify the current system clock across various platforms including DEC RT-11, DOS, IBM OS/2, Microsoft Windows, among others. This utility is integrated within command-line interpreters like COMMAND.COM, cmd.exe, as well as enhanced shells such as 4DOS, 4OS2, and 4NT.
Implementations
Beyond those, the command is implemented in Motorola VERSAdos, Intel iRMX 86, PC-MOS, SpartaDOS X, ReactOS, SymbOS, DexOS, and the EFI shell environment. On MS-DOS systems, it has been a standard feature starting with version 1.
For Unix-like operating systems, comparable capabilities to display and adjust both date and time are provided by the date command.
Syntax
The exact command syntax differs depending on the operating system and shell variant:
DOS
<syntaxhighlight lang="text"> TIME [time] </syntaxhighlight>
OS/2 (CMD.EXE)
<syntaxhighlight lang="text"> TIME [hh-mm-ss] [/N] </syntaxhighlight>
Note that the /N switch prevents the command from prompting for input when setting the time.
Windows (CMD.EXE)
<syntaxhighlight lang="text"> TIME [/T | time] </syntaxhighlight>
When executed, this command shows the current time and pauses for user input to enter a new time. If no input is provided and RETURN is pressed, the existing time remains unchanged. The '/T' option—available from Windows Vista onward with Command Extensions enabled—displays the time without requesting further input.
4DOS, 4OS2 and 4NT
<syntaxhighlight lang="text"> TIME [/T] [hh[:mm[:ss]]] [AM | PM]
/T: display only hh: hour (0–23) mm: minute (0–59) ss: second (0–59), defaults to 0 if omitted </syntaxhighlight>
OS/2 (CMD.EXE)
- To view the current system time:
<syntaxhighlight lang="text"> [C:\]TIME Current time is: 3:25 PM Enter the new time: </syntaxhighlight>
Windows (CMD.EXE)
- Example of setting the clock to 3:42 P.M.:
<syntaxhighlight lang="text"> C:\>TIME 15:42 C:\>TIME 3:42P </syntaxhighlight>
4DOS, 4OS2 and 4NT
- Displaying the current system time:
<syntaxhighlight lang="doscon"> C:\SYS\SHELL\4DOS>TIME /T 19:30:42 </syntaxhighlight>
See also
Further reading
- Van Wolverton, MS-DOS Commands: Microsoft Quick Reference, Microsoft Press, 1990.
- Kathy Ivens & Brian Proffit, OS/2 Inside & Out, Osborne McGraw-Hill, 1993.
- Æleen Frisch, Windows 2000 Commands Pocket Reference, O'Reilly, 2001.