d

date(1)

date(1)

NAME

date - display or set the date and time

SYNOPSIS

date [-u]

date [-u]+format

date [-u] [mmddhhmm[[cc]yy]]

date [-a [-]sss[.fff]]

DESCRIPTION

The date command displays or sets the current HP-UX system clock date and time. Since the HP-UX system operates in Coordinated Universal Time (UTC), date automatically converts to and from local standard or daylight/summer time, based on your TZ environment variable. See Environment Variables in EXTERNAL INFLUENCES below.

Options

date recognizes the following option:

-uInput and output values in Coordinated Universal Time (UTC), functionally equivalent to Greenwich Mean Time (GMT), instead of in local time.

-a[-]sss[.fff]

Slowly adjust the time by sss.fff seconds (fff represents fractions of a second). This adjustment can be positive or negative. The system's clock will be sped up or slowed down until it has drifted by the number of seconds speci®ed.

Formats

The date command has two forms for displaying the date and time and one form for setting them. date [-u]

Display the current date and time. The output is the same as for the %c formatting directive for all languages except the C default language. See Formatting Directives and EXAMPLES below.

date [-u]+format

Display the current date and time according to formatting directives speci®ed in format, which is a string of zero or more formatting directives and ordinary characters. If it contains blanks, enclose it in apostrophes or quotation marks.

See Formatting Directives below.

All ordinary characters are copied unchanged into the output string.

The output string is always terminated with a newline character.

If + is speci®ed and format is omitted, only a newline is output.

date [-u] [mmddhhmm[[cc]yy]]

Set the HP-UX system clock to the date and time speci®ed. You require the superuser privilege.

If you include the -uoption, the speci®ed date and time is assumed to be in Coordinated Universal Time (UTC).

The numeric argument is interpreted left to right in two-digit pairs as follows:

mmMonth number [01-12].

ddDay number in the month [01-31].

hhHour number (24-hour system) [00-23]. mm Minute number [00-59].

cc Century minus one [19-20].

yy Last two digits of the year number [70-99, 00-37(1970-1999, 2000-2037)]. If omitted, the current year is used.

If you attempt to set the date backwards, date generates the warning,

Section 1164

− 1 −

HP-UX Release 11i: December 2000