DATE(1) COMMAND REFERENCE DATE(1)
NAME
date - print and set the date
SYNOPSIS
date [ -c ] [ -r ] [ -u ] [ -z zone ] [ -d daylight_type ] [
[yy]mmddhhmm[.ss] ] [ +format ]
DESCRIPTION
The current date, time, and time zone are printed or set
(only the superuser may do the latter). 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 AM. 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.
The options -c and -r only have effect when setting the
date. They are used to set the correction factor in the
clock to make the clock more accurate. If neither option is
used the correction factor is not changed.
The -r option resets the correction factor to 1.0. (The
correction factor will have no effect) The superuser would
typically set the date using the -r option when first
setting up the machine.
The -c option is used to compute a correction factor if the
clock is inaccurate. The superuser would usually use the -c
option after the machine has run for a relatively long time
(at least one day) and the clock has gained or lost a
significant amount (at least several seconds) of time.
To correct the clock, first set the date as shown above
(that is, without the -c option). Wait about one day and
check the clock. If the clock is not accurate, set the date
again, this time adding the -c option. If the clock is
still not accurate, wait another day and set the date again
with the -c option. The information is stored in
/usr/adm/wtmp, so don't remove this file until you're done
adjusting the clock.
If the environment variable TZNAME is set, its value is used
for the time zone when it is printed. If TZNAME contains a
comma, the text before the comma is used for standard time
and the text after the comma is used for daylight time. For
example, if TZNAME is set to ``Pacific Standard Time,Pacific
Printed 10/17/86 1
DATE(1) COMMAND REFERENCE DATE(1)
Daylight Time'', the date ``June 11, 1984 at 4:30 pm'' would
be printed as ``Mon Jun 11 16:30:00 Pacific Daylight Time
1984''.
The time zone may be set by using the -z option. The zone
may either be the number of hours west of GMT or the time
zone name. The time zone name may be upper case, lower
case, or mixed. This table shows the standard values for
zone. The default allows for daylight time if daylight time
is being observed.
Zone Standard Values
Eastern European -2 EET EET DST
Middle European -1 MET MET DST
Western European 0 WET WET DST
Atlantic 4 AST ADT
Eastern 5 EST EDT
Central 6 CST CDT
Mountain 7 MST MDT
Pacific 8 PST PDT
Aust: Eastern -10 AEST AEST
Aust: Central -10.5 ACST ACST
Aust: Western -8 AWST AWST
Other values for hours (and, optionally, minutes) west of
GMT ranging from -12[:00] to +12[:00] can also be specified.
If hours and minutes are both used, they must be separated
by a colon (:). If no operator is given, + is assumed.
Leading zeros are optional. No fractions are allowed.
The -d option sets the standard types of daylight savings
time. The daylight_types are given below.
Daylight Protocols Value
no daylight time in effect none
Eastern European EET
Middle European MET
Printed 10/17/86 2
DATE(1) COMMAND REFERENCE DATE(1)
Western European WET
United States USA
Canada CAN
Australian AUST
If there is an argument after the option that 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(3s). 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 terminated with a new-line character, unless
the final character in the format is a lone %.
Field Descriptors:
n insert a new-line character
t insert a tab character
D date as mm/dd/yy
m month of year - 01 to 12
d day of month - 01 to 31
y last 2 digits of year - 00 to 99
h abbreviated month - Jan to Dec
a abbreviated weekday - Sun to Sat
w day of week - Sunday = 0
j Julian date - 001 to 366
T time as HH:MM:SS
H hour - 00 to 23
M minute - 00 to 59
S second - 00 to 59
r time in AM/PM notation
Z time zone
OPTIONS
-c UTek will compute a new correction factor using the
formula:
diff = time_of_day - new_time
if (diff>0) /* clock is fast */
correction_factor = elapsed_time / (diff + elapsed_time)
if (diff<0) /* clock is slow */
correction_factor = -diff + elapsed_time / elapsed_time
-r Reset the correction factor to 1.0.
-u Universal time. The time printed is Greenwich Mean Time
(GMT).
-z zone
Printed 10/17/86 3
DATE(1) COMMAND REFERENCE DATE(1)
Use the given zone.
-d daylight_type
Use the given daylight notation.
EXAMPLES
The following command
date -z est -d none
sets to Eastern time with no daylight savings time.
The following command
date -z 02:13
sets the time zone for 2 hours, 13 minutes west of
Greenwich.
The following command
date '+DATE: %m/%d/%y%nTIME: %H:%M:%S'
generates output like:
DATE: 08/01/76
TIME: 14:45:05
FILES
/usr/adm/wtmp The new date is written to this
file if the date is set.
/etc/rc.date Resets the desired time zone when
the workstation is rebooted.
VARIABLES
TZNAME Time zone name. Either a single name or a
comma-separated pair.
RETURN VALUE
[NO_ERRS] Command completed without error.
[USAGE] Incorrect command line syntax. Execution
terminated.
[NP_ERR] An error occurred that was not a system
error. Execution terminated.
[P_WARN] A system error occurred. Execution continues.
See intro(2) for more information on system
errors.
SEE ALSO
cal(1), gettimeofday(2), ctime(3c).
Printed 10/17/86 4
%%index%%
na:72,65;
sy:137,319;
de:456,2415;3015,2090;5249,1563;
op:6812,585;7541,130;
ex:7671,461;
fi:8132,314;
va:8446,168;
rv:8614,505;
se:9119,143;
%%index%%000000000175