HP-UX Reference (11i v2 04/09) - 1 User Commands A-M (vol 1)

d
date(1) date(1)
for your locale) to set the clock backwards; anything else to cancel the command.
no permission
You need the superuser privilege to change the date.
EXAMPLES
Date in Different Languages
Display the date. In this example, the
TZ environment variable contains PST8PDT, and the language
environment variables are set as noted.
date Fri Aug 20 15:03:37 PDT 1993
C (default)
date -u Fri Aug 20 22:03:37 UTC 1993
C (default)
date Fri, Aug 20, 1993 03:03:37 PM
en_US.roman8 (U.S. English)
date Fri. 20 Aug, 1993 03:03:37 PM
en_GB.roman8 (U.K. English)
date 20/08/1993 15.47.47 pt_PT.roman8 (Portuguese)
Set Date
Set the date to Oct 8, 12:45 a.m.
date 10080045
Display Formatted Date
Display the current date and time using a format. Note the use of quotation marks due to the blanks in
the format.
date "+DATE: %m/%d/%y%nTIME: %H:%M:%S"
The output resembles the following:
DATE: 10/08/87
TIME: 12:45:05
Display Formatted Date Using Local Language Conversion
With the date as set in the "Set Date" example above and LC_TIME
set to de_De.roman8 (German):
date +’%-4.4h %2.1d %H:%M’
generates output similar to:
Okt 8 12:45
where the month field is four characters long, flush-left, and space-padded on the right if the month name
is shorter than four characters. The day field is two characters long, with leading zeros suppressed.
WARNINGS
The former HP-UX format directive
A has been changed to W for ANSI compatibility.
Changing the date while the system is running in multiuser mode should be avoided to prevent disrupt-
ing user-scheduled and time sensitive programs and processes. Also, changing the date can cause
make(1) and the SCCS and cron(1M) subsystems to behave in an unexpected manner. The
cron daemon
should be killed prior to setting the date backwards, then restarted. SCCS files should be checked with
the val command (see val(1)) if deltas have been made while the clock was wrongly set.
The following formatting directives may be deleted from future releases:
%E, %F, %o, %z.
Currently, the maximum date supported is December 31, 2037 23:59:00 UTC.
AUTHOR
date was developed by AT&T and HP.
FILES
/var/adm/wtmps
SEE ALSO
locale(1), stime(2), ctime(3C), strftime(3C), tztab(4), environ(5), lang(5), langinfo(5).
STANDARDS CONFORMANCE
date: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2
Section 1182 Hewlett-Packard Company 5 HP-UX 11i Version 2: September 2004