DATE (command)

From Wikipedia, the free encyclopedia
  (Redirected from Time and date)
Jump to: navigation, search
For the Unix command, see date (Unix).

In computing, DATE is a command in DOS, OS/2 and Windows that is used to display and set the current date of the operating system. This command is available in command line interpreters (shells) such as COMMAND.COM, CMD.EXE, 4DOS, 4OS2 and 4NT.

In Unix, the date command displays and sets both the time and date, in a similar manner. 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.


The syntax differs depending on the specific platform and implementation:


DATE [date]

OS/2 (CMD.EXE)[edit]

DATE [mm-dd-yy] or [dd-mm-yy] or [yy-mm-dd] or [yy-dd-mm]

Windows (CMD.EXE)[edit]

 DATE [/T | date]

When this command is called from the command line or a batch script, it will display the date and wait for the user to type a new date and press RETURN. The parameter '/T' will bypass asking the user to reset the date.

The format of the date parameter is dependent upon regional settings' "short date" field.

4DOS, 4OS2 and 4NT[edit]

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[edit]

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)[edit]

  • Display the system date:
Current date is: Wed  2.12.2010
Enter the new date: (

Windows (CMD.EXE)[edit]

  • 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, 4OS2 and 4NT[edit]

  • Display the system date:
Wed  7.05.2008

Windows PowerShell[edit]

  • 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 16 November 1982)).Days
  • 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

See also[edit]