Document localtime and strflocaltime

This commit is contained in:
Nicolas Williams committed 2017-02-23 23:39:24 -06:00
1 parent 06f20603f6
commit 27c29aeb7b
2 files changed
+23 -15

No files matched your search

+17 -12
View File
@@ -1846,19 +1846,23 @@ sections:
the Unix epoch. the Unix epoch.
Low-level jq interfaces to the C-library time functions are Low-level jq interfaces to the C-library time functions are
also provided: `strptime`, `strftime`, `mktime`, and `gmtime`. also provided: `strptime`, `strftime`, `strflocaltime`,
Refer to your host operating system's documentation for the `mktime`, `gmtime`, and `localtime`. Refer to your host
format strings used by `strptime` and `strftime`. Note: these operating system's documentation for the format strings used
are not necessarily stable interfaces in jq, particularly as by `strptime` and `strftime`. Note: these are not necessarily
to their localization functionality. stable interfaces in jq, particularly as to their localization
functionality.
The `gmtime` builtin consumes a number of seconds since the The `gmtime` builtin consumes a number of seconds since the
Unix epoch and outputs a "broken down time" representation of Unix epoch and outputs a "broken down time" representation of
time as an array of numbers representing (in this order): the Greenwhich Meridian time as an array of numbers representing
year, the month (zero-based), the day of the month, the hour (in this order): the year, the month (zero-based), the day of
of the day, the minute of the hour, the second of the minute, the month, the hour of the day, the minute of the hour, the
the day of the week, and the day of the year -- all one-based second of the minute, the day of the week, and the day of the
unless otherwise stated. year -- all one-based unless otherwise stated.
The `localtime` builtin works like the `gmtime` builtin, but
using the local timezone setting.
The `mktime` builtin consumes "broken down time" The `mktime` builtin consumes "broken down time"
representations of time output by `gmtime` and `strptime`. representations of time output by `gmtime` and `strptime`.
@@ -1867,8 +1871,9 @@ sections:
`fmt` argument. The output is in the "broken down time" `fmt` argument. The output is in the "broken down time"
representation consumed by `gmtime` and output by `mktime`. representation consumed by `gmtime` and output by `mktime`.
The `strftime(fmt)` builtin formats a time with the given The `strftime(fmt)` builtin formats a time (GMT) with the
format. given format. The `strflocaltime` does the same, but using
the local timezone setting.
The format strings for `strptime` and `strftime` are described The format strings for `strptime` and `strftime` are described
in typical C library documentation. The format string for ISO in typical C library documentation. The format string for ISO
+6 -3
View File
@@ -2032,10 +2032,13 @@ The \fBtodate\fR builtin is an alias for \fBtodateiso8601\fR\.
The \fBnow\fR builtin outputs the current time, in seconds since the Unix epoch\. The \fBnow\fR builtin outputs the current time, in seconds since the Unix epoch\.
. .
.P .P
Low\-level jq interfaces to the C\-library time functions are also provided: \fBstrptime\fR, \fBstrftime\fR, \fBmktime\fR, and \fBgmtime\fR\. Refer to your host operating system\'s documentation for the format strings used by \fBstrptime\fR and \fBstrftime\fR\. Note: these are not necessarily stable interfaces in jq, particularly as to their localization functionality\. Low\-level jq interfaces to the C\-library time functions are also provided: \fBstrptime\fR, \fBstrftime\fR, \fBstrflocaltime\fR, \fBmktime\fR, \fBgmtime\fR, and \fBlocaltime\fR\. Refer to your host operating system\'s documentation for the format strings used by \fBstrptime\fR and \fBstrftime\fR\. Note: these are not necessarily stable interfaces in jq, particularly as to their localization functionality\.
. .
.P .P
The \fBgmtime\fR builtin consumes a number of seconds since the Unix epoch and outputs a "broken down time" representation of time as an array of numbers representing (in this order): the year, the month (zero\-based), the day of the month, the hour of the day, the minute of the hour, the second of the minute, the day of the week, and the day of the year \-\- all one\-based unless otherwise stated\. The \fBgmtime\fR builtin consumes a number of seconds since the Unix epoch and outputs a "broken down time" representation of Greenwhich Meridian time as an array of numbers representing (in this order): the year, the month (zero\-based), the day of the month, the hour of the day, the minute of the hour, the second of the minute, the day of the week, and the day of the year \-\- all one\-based unless otherwise stated\.
.
.P
The \fBlocaltime\fR builtin works like the \fBgmtime\fR builtin, but using the local timezone setting\.
. .
.P .P
The \fBmktime\fR builtin consumes "broken down time" representations of time output by \fBgmtime\fR and \fBstrptime\fR\. The \fBmktime\fR builtin consumes "broken down time" representations of time output by \fBgmtime\fR and \fBstrptime\fR\.
@@ -2044,7 +2047,7 @@ The \fBmktime\fR builtin consumes "broken down time" representations of time out
The \fBstrptime(fmt)\fR builtin parses input strings matching the \fBfmt\fR argument\. The output is in the "broken down time" representation consumed by \fBgmtime\fR and output by \fBmktime\fR\. The \fBstrptime(fmt)\fR builtin parses input strings matching the \fBfmt\fR argument\. The output is in the "broken down time" representation consumed by \fBgmtime\fR and output by \fBmktime\fR\.
. .
.P .P
The \fBstrftime(fmt)\fR builtin formats a time with the given format\. The \fBstrftime(fmt)\fR builtin formats a time (GMT) with the given format\. The \fBstrflocaltime\fR does the same, but using the local timezone setting\.
. .
.P .P
The format strings for \fBstrptime\fR and \fBstrftime\fR are described in typical C library documentation\. The format string for ISO 8601 datetime is \fB"%Y\-%m\-%dT%H:%M:%SZ"\fR\. The format strings for \fBstrptime\fR and \fBstrftime\fR are described in typical C library documentation\. The format string for ISO 8601 datetime is \fB"%Y\-%m\-%dT%H:%M:%SZ"\fR\.