- Time and date
In
computing ,time
anddate
are commands that are used to display and set the currenttime and date of theoperating system . Both commands are available inDOS ,OS/2 andMicrosoft Windows command line interpreter s (shells) such as
,COMMAND.COM
andcmd.exe 4DOS /4NT . TheUnix commanddate
displays both the time and date, but does not allow the normal users to change either. Users withsuperuser privileges may usedate -s
to change the time and date. The Unix commandtime
performs a different function. InWindows PowerShell ,date
is a short form for theGet-Date
Cmdlet which returns the currentsystem time object. TheSet
verb of the Cmdlet is used to set both date and time.yntax
The syntax of both commands differs depending on the specific platform and implemenation:
Microsoft Windows (cmd.exe)
Note: When these commands are called from the command line or a batch script, they will display the time or date and wait for the user to type a new time or date and press RETURN. The parameter '/t' will bypass asking the user to reset the time or date.
4DOS/4NT
Windows PowerShell
OS/2 (cmd.exe)
Note:
/N
means no prompt forTIME
. This parameter is not available in theDATE
command.Examples
Microsoft Windows (cmd.exe)
*To set the computer clock to 3:42 P.M., either of the following commands can be used:
*To change the date to November 16, 1982, any of the following can be entered at the prompt:
*To display the current system date, type the following command:
4DOS/4NT
*Display the current system time:
*Display the system date:
Windows PowerShell
*Adjust the current system time by -5 minutes:
*Return the number of days between now and a given date:
*Return the current system time and display it in a localized date and time format:
OS/2 (cmd.exe)
*Display the current system time:
*Display the system date:
ee also
*
List of DOS commands
*List of Unix programs References
* [http://technet.microsoft.com/en-us/library/bb491015.aspx Microsoft TechNet Time article]
* [http://technet.microsoft.com/en-us/library/bb490889.aspx Microsoft TechNet Date article]
Wikimedia Foundation. 2010.