aboutsummaryrefslogtreecommitdiff
path: root/bin/date/date.1
diff options
context:
space:
mode:
Diffstat (limited to 'bin/date/date.1')
-rw-r--r--bin/date/date.159
1 files changed, 40 insertions, 19 deletions
diff --git a/bin/date/date.1 b/bin/date/date.1
index 7254e7e83e3b..286b1f45414a 100644
--- a/bin/date/date.1
+++ b/bin/date/date.1
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)date.1 8.3 (Berkeley) 4/28/95
-.\" $FreeBSD$
-.\"
-.Dd November 3, 2021
+.Dd May 19, 2023
.Dt DATE 1
.Os
.Sh NAME
@@ -42,6 +39,7 @@
.\" Display time.
.Nm
.Op Fl nRu
+.Op Fl z Ar output_zone
.Op Fl I Ns Op Ar FMT
.Op Fl r Ar filename
.Op Fl r Ar seconds
@@ -56,6 +54,7 @@
.\" Set time with the default input format.
.Nm
.Op Fl jnRu
+.Op Fl z Ar output_zone
.Op Fl I Ns Op Ar FMT
.Oo
.Sm off
@@ -77,6 +76,7 @@
.\" Set time with the user-provided input format.
.Nm
.Op Fl jnRu
+.Op Fl z Ar output_zone
.Op Fl I Ns Op Ar FMT
.Oo
.Sm off
@@ -202,6 +202,14 @@ displays the time in the time zone described by
or the
.Ev TZ
environment variable.
+.It Fl z Ar output_zone
+Just before printing the time, change to the specified timezone;
+see the description of
+.Ev TZ
+below.
+This can be used with
+.Fl j
+to easily convert time specifications from one zone to another.
.It Xo
.Fl v
.Sm off
@@ -215,8 +223,8 @@ day, week day, month or year according to
.Ar val .
If
.Ar val
-is preceded with a plus or minus sign,
-the date is adjusted forwards or backwards according to the remaining string,
+is preceded by a plus or minus sign,
+the date is adjusted forward or backward according to the remaining string,
otherwise the relevant part of the date is set.
The date can be adjusted as many times as required using these flags.
Flags are processed in the order given.
@@ -227,7 +235,15 @@ seconds are in the range 0-59, minutes are in the range 0-59, hours are
in the range 0-23, month days are in the range 1-31, week days are in the
range 0-6 (Sun-Sat),
months are in the range 1-12 (Jan-Dec)
-and years are in the range 80-38 or 1980-2038.
+and years are in a limited range depending on the platform.
+.Pp
+On i386, years are in the range 69-38 representing 1969-2038.
+On every other platform, years 0-68 are accepted and represent 2000-2068, and
+69-99 are accepted and represent 1969-1999.
+In both cases, years between 100 and 1900 (both included) are accepted and
+interpreted as relative to 1900 of the Gregorian calendar with a limit of 138 on
+i386 and a much higher limit on every other platform.
+Years starting at 1901 are also accepted, and are interpreted as absolute years.
.Pp
If
.Ar val
@@ -268,7 +284,7 @@ will be necessary to reach October 29, 2:30.
.Pp
When the date is adjusted to a specific value that does not actually exist
(for example March 26, 1:30 BST 2000 in the Europe/London timezone),
-the date will be silently adjusted forwards in units of one hour until it
+the date will be silently adjusted forward in units of one hour until it
reaches a valid time.
When the date is adjusted to a specific value that occurs twice
(for example October 29, 1:30 2000),
@@ -345,9 +361,9 @@ Seconds, a number from 0 to 60
Everything but the minutes is optional.
.Pp
.Nm
-understands the time zone definitions in the
-.Sy tzdata
-package located in
+understands the time zone definitions from the IANA Time Zone Database,
+.Sy tzdata ,
+located in
.Pa /usr/share/zoneinfo .
Time changes for Daylight Saving Time, standard time, leap seconds
and leap years are handled automatically.
@@ -359,9 +375,8 @@ If the file or symlink
exists, it is interpreted as a time zone definition file, usually in
the directory hierarchy
.Pa /usr/share/zoneinfo ,
-which contains the time zone definitions from the
-.Sy tzdata
-package.
+which contains the time zone definitions from
+.Sy tzdata .
.Pp
If the environment variable
.Ev TZ
@@ -507,13 +522,20 @@ will display
.Pp
.Dl "2018-08-04T13:42:19-07:00"
.Pp
-Finally the command:
+The command:
.Pp
-.Dl "date -j -f ""%a %b %d %T %Z %Y"" ""`LC_ALL=C date`"" ""+%s"""
+.Dl "env LC_ALL=C date -j -f ""%a %b %d %T %Z %Y"" ""`env LC_ALL=C date`"" ""+%s"""
.Pp
can be used to parse the output from
.Nm
and express it in Epoch time.
+.Pp
+Finally the command
+.Pp
+.Dl "TZ=America/Los_Angeles date -z Europe/Paris -j 0900"
+.Pp
+will print the time in the "Europe/Paris" timezone when it is 9:00 in The
+America/Los_Angeles timezone.
.Sh DIAGNOSTICS
It is invalid to combine the
.Fl I
@@ -570,9 +592,8 @@ A number of options were added and then removed again, including the
(set DST flag) and
.Fl t
(set negative time zone offset).
-Time zones are now handled by the
-.Sy tzdata
-package.
+Time zones are now handled by code bundled with
+.Sy tzdata .
.Pp
The
.Fl I