This MedLibrary.org supplementary page on Date (command) is provided directly from the open source Wikipedia as a service to our readers. Please see the note below on authorship of this content, as well as the Wikipedia usage guidelines. To search for other content from our encyclopedia supplement, please use the form below:
Related Sponsors
In computing, time and date are commands that are used to display and set the current time and date of the operating system. Both commands are available in DOS, OS/2 and Microsoft Windows command line interpreters (shells) such as COMMAND.COM, cmd.exe and 4DOS/4NT. The Unix command date displays both the time and date, but does not allow the normal users to change either. Users with superuser privileges may use date -s <new-date-time> to change the time and date. The Unix command time performs a different function. In Windows PowerShell, date is a short form for the Get-Date Cmdlet which returns the current system time object. The Set verb of the Cmdlet is used to set both date and time.
Contents |
Syntax
The syntax of both commands differs depending on the specific platform and implemenation:
Microsoft Windows (cmd.exe)
time [/t] [/time] [hours:[minutes[:seconds[.hundredths]]][{A|P}]]
date [mm-dd-yy] [/t]
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
TIME [/T] [hh[:mm[:ss]]] [AM | PM] hh: The hour (0 - 23). mm: The minute (0 - 59). ss: The second (0 - 59), set to 0 if omitted. /T: (display only)
DATE [/T] [mm-dd-yy] /T: (Display only) mm: The month (1 - 12). dd: The day (1 - 31). yy: The year (00 - 99, or a 4-digit year).
Windows PowerShell
Get-Date [[-Date] <DateTime>] [-Year <Int32>] [-Month <Int32>] [-Day <Int32>] [-Hour <Int32>] [-Minute <Int32>] [-Second <Int32>] ...
Set-Date [-Date] <DateTime> ... Set-Date [-Adjust] <TimeSpan> ...
OS/2 (cmd.exe)
TIME [hh-mm-ss] [/N]
DATE [mm-dd-yy] or [dd-mm-yy] or [yy-mm-dd] or [yy-dd-mm]
Note: /N means no prompt for TIME. This parameter is not available in the DATE command.
Examples
Microsoft Windows (cmd.exe)
- To set the computer clock to 3:42 P.M., either of the following commands can be used:
C:\> time 15:42 C:\> time 3:42P
- To change the date to November 16, 1982, any of the following can be entered at the prompt:
C:\> date 11.16.82 11-16-82 11/16/82
- To display the current system date, type the following command:
date /t
4DOS/4NT
- Display the current system time:
C:\PROGRAM FILES\JPSOFT\4DOS>time /t 19:30:42
- Display the system date:
C:\PROGRAM FILES\JPSOFT\4DOS>date /t Wed 7.05.2008
Windows PowerShell
- Adjust the current system time by -5 minutes:
PS C:\>Set-Date -Adjust (New-TimeSpan -Minutes -5) Wednesday, May 07, 2008 7:25:42 PM
- Return the number of days between now and a given date:
PS C:\>((date) - (date 11/16/1982)).Days 9304
- Return the current system time and display it in a localized date and time format:
PS C:\>$culture = new-object Globalization.CultureInfo 'de-DE' PS C:\>(date).ToString($culture) 07.05.2008 19:30:42
OS/2 (cmd.exe)
- Display the current system time:
[C:\]time Current time is: 7.30.42,21 Enter the new time:
- Display the system date:
[C:\]date Current date is: Wed 7.05.2008 Enter the new date: (dd.mm.yy)
See also
References
|
|||||||||||||||||||||||||||||
Wikipedia content modification information:
- This page was last modified on 7 May 2008, at 18:49.
Wikipedia Authorship and Review
Wikipedia content provided here is not reviewed directly by MedLibrary.org. Wikipedia content is authored by an open community of volunteers and is not produced by or in any way affiliated with MedLibrary.org.
Wikipedia Usage Guidelines
This article is licensed under the GNU Free Documentation License. It uses material from the Wikipedia article on "Date (command)".
The URL for this specific entry is:
All Wikipedia text is available under the terms of the GNU Free Documentation License. (See Copyrights for details). Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc.
