HP-UX Reference (11i v1 05/09) - 1 User Commands A-M (vol 1)
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 sys-
tem operates in Coordinated Universal Time (UTC),
date automatically converts to and from local stan-
dard or daylight/summer time, based on your
TZ environment variable. See Environment Variables in
EXTERNAL INFLUENCES below.
Options
date recognizes the following option:
-u Input 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 specified.
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 specified 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 specified 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 specified. You require the superuser
privilege.
If you include the -u option, the specified 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:
mm Month number [01-12].
dd Day number in the month [01-31].
hh Hour 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 1−−164 Hewlett-Packard Company − 1 − HP-UX 11i Version 1: September 2005