DATE – Windows CMD Command

Display or change the date.

The table above is based on Vista/Windows 7, in earlier versions of Windows, the default short date format for most countries returns a 2 digit year.

Other date and time formats

The dates and time above are only default settings, in the Control Panel users can change the date and time format including the date separator, 12/24 hour time, and leading/trailing characters. Take care not to make cultural assumptions about the user’s chosen date or time format.

The ISO standard 8601 defines a date and time format that can be used internationally: YYYY-MM-DD to avoid the confusion that is often caused by differences in language and local customs. ISO 8601 also recommends that 24 hour times have a leading zero (09:45), but not all countries follow this convention.

Errorlevels

If the Date was successfully changed (or not given) %ERRORLEVEL% = 0
If the user lacks admin privileges = 1

DATE is an internal command. If Command Extensions are disabled DATE will not support the /T switch

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *