d

date(1)

date(1)

The character c is not a valid format directive, ®eld width speci®er, or precision speci®er.

do you really want to run time backwards?[yes/no]

The date/time you speci®ed is earlier than the current clock value. Type yes (or the equivalent 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 ®eld is four characters long, ¯ush-left, and space-padded on the right if the month name is shorter than four characters. The day ®eld 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 disrupting 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 ®les 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/wtmp

Section 1168

− 5 −

HP-UX Release 11i: December 2000