Compartir a través de


Time

Displays or sets the system time. Used without parameters, time displays the system time and prompts you to enter a new time.

Syntax

time [/t] [/time] [hours**:[minutes[:seconds[.**hundredths]]][{A|P}]]

Parameters

/t   : Displays the current system time, without prompting you to enter a new time.

/time   : Same as /t.

hours   : Specifies the hour. Valid values are in the range 0 through 23.

minutes   : Specifies minutes. Valid values are in the range 0 through 59.

seconds   : Specifies seconds. Valid values are in the range 0 through 59.

hundredths   : Specifies hundredths of a second. Valid values are in the range 0 through 99.

{ A | P } : Specifies A.M or P.M. for the 12-hour time format. If you type a valid 12-hour time but do not type A or P, time uses A for A.M.

/?   : Displays help at the command prompt.

Remarks

  • When using time without parameters, press ENTER to keep the same time.

  • Using the /t parameter

    The /t command-line option is only available if command extensions are enabled (that is, the default). For more information about enabling and disabling command extensions, see cmd in Related Topics.

  • Specifying an invalid time format

    If you specify the time in an invalid format the following message is displayed and the system then waits for you to enter the time in the correct format:

    Invalid time 
    

Enter new time:_

  • Changing the time format

    You can change the time format by changing the setting in Date and Time in Control Panel. For just the MS-DOS subsystem, change the country setting in your Config.nt file. Depending on the Country/Region selected, time is displayed in the 12-hour format or the 24-hour format. If you are setting the time in the 12-hour format, specify P for hours after noon.

Examples

To set your computer clock to 1:36 P.M., type either of the following commands:

time 13:36 

time 1:36P 

Formatting legend

Format

Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

Date

Command-line reference A-Z

Cmd