datetime

The datetime command outputs the current date and time.

Using the -f (format) switch to select a .Net date format string (standard, custom), you can adjust the output format:

C:\>datetime
14.04.2011 16:11

C:\datetime -f D
Donnerstag, 14. April 2011

C:\datetime -f T
16:15:24

C:\datetime -f o
2011-04-14T16:15:02.9943652+02:00

C:\datetime -f u
2011-04-14 16:15:15Z

Use the -utc switch to retrieve the UTC timestamp:

C:\datetime -f o -utc
2011-04-14T14:16:13.3573897Z

The -ci switch selects a CultureInfo to display the date in a different language:

C:\datetime -ci fr -f D
jeudi 14 avril 2011

C:\datetime -ci fr-fr -f D
jeudi 14 avril 2011

Note that the support of culture infos depends on the version of the .Net framework.

To display the date string in a language that is not supported in the DOS code page, first switch the code page using the chcp command:

C:\chcp
Aktive Codepage: 850.

C:\netenv
input code page: 850
input Windows code page: 1252
input encoding: Western European (DOS)
output code page: 850
output Windows code page: 1252
output encoding: Western European (DOS)
culture: de-AT
LCID: 3079
culture display name: German (Austria)

C:\chcp 1251
Aktive Codepage: 1251.

C:\datetime -ci ru -f D
14 апреля 2011 г.

C:\chcp 850
Aktive Codepage: 850.