up | Inhaltsverzeichniss | Kommentar

Manual page for DATE(1V)

date - display or set the date

SYNOPSIS

date [ -u ] [ -a [ - ] sss.fff ] [ yymmddhhmm [ .ss ] ] [ +format ]

SYSTEM V SYNOPSIS

/usr/5bin/date [ -u ] [ -a [ - ] sss.fff ] [ mmddhhmm [ yy ] ] [ +format ]

AVAILABILITY

The System V version of this command is available with the System V software installation option. Refer to [a manual with the abbreviation INSTALL] for information on how to install optional software.

DESCRIPTION

If no argument is given, or if the argument begins with +, date displays the current date and time. Otherwise, the current date is set. Only the super-user may set the date.

yy is the last two digits of the year; 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; .ss (optional) specifies seconds. The year, month and day may be omitted; the current values are supplied as defaults.

If the argument begins with +, the output of date is under the control of the user. The format for the output is similar to that of the first argument to printf.3v All output fields are of fixed size (zero padded if necessary). 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 string is always terminated with a new-line character.

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 - Sun to Sat
h
abbreviated month - Jan to Dec
r
time in AM/PM notation

SYSTEM V SYNOPSIS

When setting the date, 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. The current year is the default if no year is mentioned.

OPTIONS

-u
Display the date in GMT (universal time). The system operates in GMT; date normally takes care of the conversion to and from local standard and daylight time. -u may also be used to set GMT time.
-a [-]sss.fff
Using the adjtime.2 system call, tell the system to 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.

EXAMPLES

date 10080045

Would set the date to Oct 8, 12:45 AM.

If the year were 1986, and the date were so set,

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

would generate as output:

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

FILES

/var/adm/wtmp
to record time-setting
/usr/share/lib/zoneinfo
timezone definitions

SEE ALSO

adjtime.2 printf.3v utmp.5v

DIAGNOSTICS

date: Failed to set date: Not owner
If you try to change the date but are not the super-user.
date: bad format character
If the field descriptor is not recognizable.


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97