Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ date(1) — HP-UX 6.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

stime(2)

ctime(3C)

langinfo(3C)

printf(3S)

environ(5)

DATE(1)  —  HP-UX

NAME

date − print and set the date

SYNOPSIS

date [mmddhhmm[yy]] [+format]

DESCRIPTION

If no argument is given, or if the argument begins with +, the current date and time are printed.  Otherwise the current date is set, provided you are superuser.  The first mm is the month number; dd is the day number in the month; hh is the hour number (24 hour system); the second mm is the minute number; yy is the last 2 digits of the year number and is optional.  For example:

date 10080045

sets the date to Oct 8, 12:45 a.m.  The current year is the default if no year is mentioned.  The system operates in GMT.  Date takes care of the conversion to and from local standard and daylight time by using the TZ environment variable.  The rules applied are the converse of the rules described in ctime(3C). Inspection of the form of the TZ variable will determine the setting of the tz_dsttime variable if gettimeofday(2) is supported on a given system.  Only no conversion and USA standard daylight conversion are defined for this field.  Other conversions defined by TZ will be treated as no conversion for this purpose.

Attempting to set the date backwards generates a warning, and requires an extra confirmation from the (super)user. 

When date is used to set the date, a pair of date change records is written to the file /etc/wtmp. 

If the argument begins with +, the output of date is under the control of the user.  The format string describing the output contains field descriptors, as in the first argument to printf(3S). Each field descriptor is preceded by % and will be replaced in the output by its corresponding value.  A single % is encoded by %%.  All other characters are copied to the output without change.  The output string is always terminated with a new-line character.  Numeric output fields are of fixed size (zero-padded if necessary). 

Field Descriptors:

n insert a new-line character

t insert a tab character

m month of year − 01 to 12

d day of month − 01 to 31

y last 2 digits of year − 00 to 99

D date as mm/dd/yy

H hour − 00 to 23

M minute − 00 to 59

S second − 00 to 59

T time as HH:MM:SS

j day of year − 001 to 366

w day of week − Sunday = 0

a abbreviated weekday name − Sun to Sat

W full weekday name − Sunday to Saturday

h abbreviated month − Jan to Dec

F full month name − January to December

r time in a.m./p.m.  notation

z time zone name from TZ variable in user’s environment

The full or abbreviated month name and full or abbreviated weekday name are spelled according to user’s native language, as defined by the LANG variable; see environ(5). 

If there is no argument, the current date and time are printed according to the D_T_FMT string (see langinfo(3C)) that corresponds to the current value of the variable LANG in the user’s environment. If the LANG variable is not set, ctime(3C) is used to format the date.

DIAGNOSTICS

No permission if you are not the superuser and you try to change the date;

bad conversion if the date set is syntactically incorrect;

bad format character
if the field descriptor is not recognizable.

EXAMPLES

For example:

date ´+DATE: %m/%d/%y%nTIME: %H:%M:%S´

would have generated the following as output:

DATE: 08/01/76
TIME: 14:45:05

WARNINGS

It is a bad practice to change the date while the system is running multi-user. 

DEPENDENCIES

Series 500
Do not change the date and/or time in the BASIC language system if your machine also runs HP-UX.  The two operating systems’ date and time are incompatible.

Series 300 Diskless
In a clustered environment, the date and time are automatically set when the system comes up as a cluster node. Setting the date and time from any node in a cluster will set the date and time on all nodes in the cluster.

AUTHOR

Date was developed by AT&T and HP. 

FILES

/etc/wtmp

SEE ALSO

stime(2), ctime(3C), langinfo(3C), printf(3S), environ(5). 

INTERNATIONAL SUPPORT

8-bit data, messages. 

Hewlett-Packard Company  —  Version B.1,  May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026