MS-DOS and Windows command line date command

Updated: 12/31/2020 by Computer Hope
date command

The date command can view or change the current date of the system clock.

Note

Changing the system date requires an elevated Command Prompt.

Command syntax

The following is the syntax of the date command.

Windows Vista and later

date [ /t | date ]

Type date without parameters to display the current date setting and a prompt for a new date. Press Enter to keep the same date.

If you provide a date in the format MM-DD-YY, the system date is set to that date.

Tip

When specifying a two-digit year, the digits 00-99 correspond to the years 1980-2099.

In modern versions of Windows, the date command accepts a four-digit date, e.g., MM-DD-YYYY.

With the /t switch, the date command displays the system date, without prompting for a new one.

Windows XP and earlier

In Windows XP and previous versions of Windows, the /t switch is not supported.

DATE [ date ]

Type date without parameters to display the current date setting and a prompt for a new date. Press Enter to keep the same date. Provide a date as MM-DD-YY to set the system date to that date.

Examples

date

Display the current date and prompt for a new date.

The current date is: Sat 05/09/2020
Enter the new date: (mm-dd-yy)

If you enter a new date in the format MM-DD-YY, the system date is set to that date, if you are using an elevated Command Prompt.

If you press Enter without typing a date, the current system date is not changed, and the command exits.

date 05-08-20

The command above sets the system date to March 8, 2020, in an elevated command prompt.

date /t

Displays the current system date.

Sat 05/09/2020

Availability

Date is an internal command available in the following Microsoft operating systems.

Additional information