2015-10-08 11:15:08 -04:00
|
|
|
.Dd 2015-10-08
|
2015-01-31 08:20:02 -05:00
|
|
|
.Dt DATE 1
|
2015-01-31 14:37:03 -05:00
|
|
|
.Os sbase
|
2015-01-23 16:54:25 -05:00
|
|
|
.Sh NAME
|
|
|
|
.Nm date
|
2017-01-01 20:09:53 -05:00
|
|
|
.Nd print or set date and time
|
2015-01-23 16:54:25 -05:00
|
|
|
.Sh SYNOPSIS
|
2015-01-30 15:17:58 -05:00
|
|
|
.Nm
|
2015-01-23 16:54:25 -05:00
|
|
|
.Op Fl d Ar time
|
|
|
|
.Op Fl u
|
2017-01-01 20:09:53 -05:00
|
|
|
.Oo
|
|
|
|
.Cm + Ns Ar format |
|
|
|
|
.Sm off
|
|
|
|
.Ar mmddHHMM Oo Oo Ar CC Oc Ar yy Oc
|
|
|
|
.Sm on
|
|
|
|
.Oc
|
2015-01-23 16:54:25 -05:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Nm
|
|
|
|
prints the date and time according to
|
|
|
|
.Xr locale 7
|
|
|
|
or
|
|
|
|
.Ar format
|
|
|
|
using
|
2017-01-01 20:09:53 -05:00
|
|
|
.Xr strftime 3
|
|
|
|
or sets the date.
|
2015-01-23 16:54:25 -05:00
|
|
|
.Sh OPTIONS
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl d Ar time
|
|
|
|
Print
|
|
|
|
.Ar time
|
|
|
|
given as the number of seconds since the
|
|
|
|
Unix epoch 1970-01-01T00:00:00Z.
|
|
|
|
.It Fl u
|
2017-01-01 20:09:53 -05:00
|
|
|
Print or set UTC time instead of local time.
|
2015-01-23 16:54:25 -05:00
|
|
|
.El
|
2017-01-01 20:09:53 -05:00
|
|
|
.Pp
|
|
|
|
An operand with a leading plus
|
|
|
|
.Pq Cm +
|
|
|
|
sign signals a user-defined format string using
|
|
|
|
.Xr strftime 3
|
|
|
|
conversion specifications.
|
|
|
|
.Pp
|
|
|
|
An operand without a leading plus sign is interpreted as a value
|
2020-03-01 17:37:31 -05:00
|
|
|
for setting the system's current date and time.
|
|
|
|
The canonical representation for setting the date and time is:
|
2017-01-01 20:09:53 -05:00
|
|
|
.Pp
|
|
|
|
.Bl -tag -width Ds -compact -offset indent
|
|
|
|
.It Ar mm
|
|
|
|
The month of the year, from 01 to 12.
|
|
|
|
.It Ar dd
|
|
|
|
The day of the month, from 01 to 31.
|
|
|
|
.It Ar HH
|
|
|
|
The hour of the day, from 00 to 23.
|
|
|
|
.It Ar MM
|
|
|
|
The minute of the hour, from 00 to 59.
|
|
|
|
.It Ar CC
|
|
|
|
The first two digits of the year (the century).
|
|
|
|
.It Ar yy
|
|
|
|
The second two digits of the year.
|
|
|
|
If
|
|
|
|
.Ar yy
|
|
|
|
is specified, but
|
|
|
|
.Ar CC
|
|
|
|
is not, a value for
|
|
|
|
.Ar yy
|
|
|
|
between 69 and 99 results in a
|
|
|
|
.Ar CC
|
2020-03-01 17:37:31 -05:00
|
|
|
value of 19.
|
|
|
|
Otherwise, a
|
2017-01-01 20:09:53 -05:00
|
|
|
.Ar CC
|
|
|
|
value of 20 is used.
|
|
|
|
.El
|
|
|
|
.Pp
|
2020-03-01 17:37:31 -05:00
|
|
|
The century and year are optional.
|
|
|
|
The default is the current year.
|
2015-01-23 16:54:25 -05:00
|
|
|
.Sh STANDARDS
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility is compliant with the
|
2015-03-27 12:22:48 -04:00
|
|
|
.St -p1003.1-2013
|
2015-01-23 16:54:25 -05:00
|
|
|
specification.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Op Fl d
|
|
|
|
flag is an extension to that specification.
|