date.1.in (2554B)
- .\" utils-std: Collection of commonly available Unix tools
- .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- .\" SPDX-License-Identifier: MPL-2.0
- .Dd 2024-07-25
- .Dt DATE 1
- .Os
- .Sh NAME
- .Nm date
- .Nd display date and time
- .Sh SYNOPSIS
- .Nm
- .Op Fl jRu
- .Op Fl d Ar datetime | Fl r Ar epoch
- .Op Cm + Ns Ar format
- .Nm
- .Op Fl jRu
- .Ar mmddHHMM Ns Oo Oo Ar CC Oc Ns Ar yy Oc
- .Op Cm + Ns Ar format
- .Nm
- .Op Fl jRu
- .Fl f Ar now_format
- .Ar now
- .Op Cm + Ns Ar format
- .Sh DESCRIPTION
- When
- .Nm
- is invoked without arguments it displays the current datetime
- Otherwise, depending on the options specified, will print the datetime in a user-defined way.
- .Sh OPTIONS
- .Bl -tag -width Ds
- .It Fl d Ar datetime
- Use
- .Ar datetime
- instead of current datetime.
- include(lib/iso_parse.mdoc)
- .It Fl f Ar now_format
- Use
- .Ar now_format
- as the
- .Xr strptime 3
- format string for
- .Ar now ,
- which will be used instead of the current datetime.
- .It Fl j
- Do no set the system date.
- This allows to use the
- .Fl f
- flag to convert one datetime to another.
- .It Fl u
- Use UTC (coordinated universal time) instead of the local time.
- .It Fl r Ar epoch
- Use
- .Ar epoch
- (seconds relative to 1970-01-01 00:00:00 UTC)
- instead of current datetime.
- .It Fl R
- Set the default value of
- .Ar format
- to match RFC5322 (Internet Message Format).
- .It Ar mmddHHMM Ns Oo Oo Ar CC Oc Ns Ar yy Oc
- Sets custom datetime, if
- .Fl j
- isn't set, the system time is also set.
- .Pp
- Each letters corresponds to:
- .Bl -tag -width mm -compact
- .It mm
- months aka %m
- .It dd
- days aka %d
- .It HH
- hours aka %H
- .It MM
- minutes aka %M
- .It CC
- centuries aka %C
- .It yy
- century-less years aka %y
- .El
- .Pp
- For example 072505542024 corresponds to 2024-07-25T05:54, as you can verify with the following command:
- .Dl date -j 072505542024 +%Y-%m-%dT%H:%M
- .It Cm + Ns Ar format
- Set the displayed datetime in
- .Xr strftime 3
- format.
- Otherwise defaults to
- .Ql %c
- .El
- .Sh ENVIRONMENT
- Look at the manual page of
- .Xr strftime 3
- for the environment variables, typical ones are
- .Ev TZ ,
- .Ev LC_TIME
- and
- .Ev LC_ALL
- but this depends on your system.
- .Sh EXIT STATUS
- .Ex -std
- .Sh SEE ALSO
- .Xr clock_settime 3 ,
- .Xr strftime 3
- .Sh STANDARDS
- .Nm
- should be compliant with the
- IEEE Std 1003.1-2024 (“POSIX.1”)
- specification.
- .Pp
- The
- .Fl d
- and
- .Fl R
- options are present for compatibility with other modern systems such as
- NetBSD, BusyBox, and GNU coreutils.
- .br
- The
- .Fl r
- option is inspired from BSD and illumos,
- .Fl f
- and
- .Fl j
- options are inspired by FreeBSD and NetBSD.
- .Sh AUTHORS
- .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me