Name

time

Synopsis

Display or set the system time.

Syntax

time [/t | time]

Description

Like date (discussed earlier in this chapter), time is essentially a holdover from the very early days of DOS when the user was required to enter the system date and time every time the computer was started. Now it’s essentially included as a way to set the data from the command line; the preferred method is to use Control Panel Date and Time.

If you type time on the command line without an option, the current time setting is displayed, and you are prompted for a new one. Press Enter to keep the same date.

The time options are:

time

Sets the system time without a prompt. The format of time is hh:mm:ss [A|P], where:

hh

Hours: valid values = 0-23

mm

Minutes: valid values = 0-59

ss

Seconds: valid values = 0-59

A|P

A.M. or P.M. (for a 12-hour format). If a valid 12-hour format is entered without an A or P, A is the default.

/t

Displays the current time without prompting for a new one.

Notes

  • The time format depends on settings in Control Panel Regional and Language Options.

  • Windows records the current time for each file you create or change. This time is listed next to the filename in the dir directory listing.

  • The time display format for most applications can be changed in Control Panel Regional and Language Options Regional Options tab Customize, but this doesn’t affect the output of the DOS time command.

  • To have Windows automatically synchronize the clock with an Internet time server, go to Control ...

Get Windows XP in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.