.\" @(#)date.1 1.35 95/10/11 SMI;
.\" Copyright (c) 1995, Sun Microsystems, Inc.
.\" All Rights Reserved
.\" Portions Copyright (c) 1992, X/Open Company Limited
.\" All Rights Reserved
.TH date 1 "15 Sep 1995"
.SH NAME
date \- write the date and time
.SH SYNOPSIS
.BI "/usr/bin/date [\|\-u\|] [\|+" format \|]
.br
.BI "/usr/bin/date [\|\-a [\|\-\|]\|" sss.fff \|]
.br
.BI "/usr/bin/date [\|\-u\|] [\|[\|" mmdd \|]\| HHMM
.BI "| " mmddHHMM \|[\| cc \|]\| yy\c
.BI \|][ .SS ]
.LP
.BI "/usr/xpg4/bin/date [\|\-u\|] [\|+" format \|]
.br
.BI "/usr/xpg4/bin/date [\|\-a [\|\-\|]\|" sss.fff \|]
.br
.BI "/usr/xpg4/bin/date [\|\-u\|] [\|[\|" mmdd \|]\| HHMM
.BI "| " mmddHHMM \|[\| cc \|]\| yy\c
.BI \|][ .SS ]
.SH AVAILABILITY
.SS /usr/bin/date
SUNWcsu
.SS /usr/xpg4/bin/date
SUNWxcu4
.SH DESCRIPTION
.IX "date" "" "\fLdate\fP \(em display date and/or set date"
.IX "display" "date" "" "\(em \fLdate\fP"
The
.B date
utility writes the date and time to standard output
or attempts to set the system date and time.
By default, the current date and time will be written.
.LP
Specifications of native language translations of
month and weekday names are supported.
The month and weekday names used for a language are based
on the locale specified by the environment variable
.SB LC_TIME\f1\s0;
see
.BR environ (5).
.LP
The following is the default form for the "C" locale:
.IP
.I "%a %b %e %T %Z %Y"
.LP
for example,
.IP
.B "Fri Dec 23 10:10:42 EST 1988"
.SH OPTIONS
The following options are supported:
.TP 12
.BI "\-a [\|\-\|]\|" sss.fff
Slowly adjust the time by
.IR sss . fff
seconds
.RI ( 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.
.TP
.B \-u
Display (or set) the date in Greenwich Mean Time
(\s-1GMT\s0\(emuniversal time),
bypassing the normal conversion to
(or from) local time.
.SH OPERANDS
The following operands are supported:
.TP 12
.BI + format
If the argument begins with
.BR + ,
the output of
.B date
is the result of passing 
.I format
and the current time to 
.BR strftime(\|) .
.B date
uses the conversion specifications listed on the
.BR strftime (3C)
manual page, with the conversion specification for
.B %C
determined by whether
.B /usr/bin/date
or
.B /usr/xpg4/bin/date
is used:
.RS 12
.TP 18
.B /usr/bin/date
Locale's date and time representation.
This is the default output for
.BR date .
.TP
.B /usr/xpg4/bin/date
Century (a year divided by 100 and truncated to an integer) as a
decimal number [00-99].
.LP
The string is always terminated with a
.SM NEWLINE\s0.
An argument containing blanks must be quoted; see the
.B EXAMPLES
section.
.RE
.br
.ne 2
.TP 12
.I mm\^
Month number
.PD 0
.TP
.I dd\^
Day number in the month
.TP
.I HH\^
Hour number (24 hour system)
.TP
.I MM\^
Minute number
.TP
.I SS\^
Second number
.TP
.I cc\^
Century minus one
.TP
.I yy\^
Last 2 digits of the year number
.PD
.br
.ne 5
.IP
The month, day, year, and century may be omitted;
the current values are applied as defaults.
For example:
.sp 1n
.RS 20
.B "date\| 10080045"
.RE
.sp 1n
.RS 12
sets the date to Oct 8, 12:45 a.m.
The current year is the default because no year is supplied.
The system operates in \s-1GMT\s0.
.B date
takes care of the conversion to and from
local standard and daylight time.
Only the super-user may change the date.
After successfully setting the date and time,
.B date
displays the new date according
to the default format.
The
.B date
command uses
.B TZ
to determine the correct time zone information;
see
.BR environ (5).
.RE
.SH EXAMPLES
The command
.P
.RS
.ft 3
.nf
example% date '+DATE: %m/%d/%y%nTIME: %H:%M:%S'
.ft 1
.fi
.RE
.PP
generates as output:
.PP
.RS
.ft 3
.nf
DATE: 08/01/76
TIME: 14:45:05
.fi
.ft 1
.RE
The command
.P
.RS
.ft 3
.nf
example# date 1234.56
.ft 1
.fi
.RE
.PP
sets the current time to 12:34:56.
.ft 1
.SH ENVIRONMENT
See 
.BR environ (5)
for descriptions of the following environment variables that affect
the execution of 
.BR date :
.SB LC_CTYPE\f1\s0,
.SB LC_TIME\f1\s0,
.SB LC_MESSAGES\f1\s0,
and
.SB NLSPATH\f1\s0.
.TP 12
.SB TZ
Determine the timezone in which the time and date are written,
unless the
.B \-u
option is specified.  If the
.SB TZ
variable is not set and the
.B \-u
is not specified, the system default timezone is used.
.SH "EXIT STATUS"
The following exit values are returned:
.PD 0
.TP 10
.B 0
Successful completion.
.TP
.B >0
An error occurred.
.PD
.SH SEE ALSO
.BR strftime (3C),
.BR environ (5)
.\".Ee
.SH DIAGNOSTICS
.PD 0
.TP 20
.B "no permission"
You are not the super-user and you tried to change the date.
.TP
.B "bad conversion"
The date set is syntactically incorrect.
.PD
.SH NOTES
.LP
If you attempt to set the current date to one of the dates that the standard and alternate time zones change
(for example, the date that daylight time is starting or ending),
and you attempt to set the time to a time in the interval
between the end of standard time and the beginning of the alternate time
(or the end of the alternate time and the beginning of standard time),
the results are unpredictable.

