GNU Info

Info Node: (tar.info)General date syntax

(tar.info)General date syntax


Next: Calendar date items Up: Date input formats
Enter node , (file) or (file)node

General date syntax
===================

   A "date" is a string, possibly empty, containing many items
separated by whitespace.  The whitespace may be omitted when no
ambiguity arises.  The empty string means the beginning of today (i.e.,
midnight).  Order of the items is immaterial.  A date string may contain
many flavors of items:

   * calendar date items

   * time of the day items

   * time zone items

   * day of the week items

   * relative items

   * pure numbers.

We describe each of these item types in turn, below.

   A few numbers may be written out in words in most contexts.  This is
most useful for specifying day of the week items or relative items (see
below).  Here is the list: `first' for 1, `next' for 2, `third' for 3,
`fourth' for 4, `fifth' for 5, `sixth' for 6, `seventh' for 7, `eighth'
for 8, `ninth' for 9, `tenth' for 10, `eleventh' for 11 and `twelfth'
for 12.  Also, `last' means exactly -1.

   When a month is written this way, it is still considered to be
written numerically, instead of being "spelled in full"; this changes
the allowed strings.

   In the current implementation, only English is supported for words
and abbreviations like `AM', `DST', `EST', `first', `January',
`Sunday', `tomorrow', and `year'.

   The output of `date' is not always acceptable as a date string, not
only because of the language problem, but also because there is no
standard meaning for time zone items like `IST'.  When using `date' to
generate a date string intended to be parsed later, specify a date
format that is independent of language and that does not use time zone
items other than `UTC' and `Z'.  Here are some ways to do this:

     $ LC_ALL=C TZ=UTC0 date
     Fri Dec 15 19:48:05 UTC 2000
     $ TZ=UTC0 date +"%Y-%m-%d %H:%M:%SZ"
     2000-12-15 19:48:05Z
     $ date --iso-8601=seconds  # a GNU extension
     2000-12-15T11:48:05-0800
     $ date --rfc-822  # a GNU extension
     Fri, 15 Dec 2000 11:48:05 -0800
     $ date +"%Y-%m-%d %H:%M:%S %z"  # %z is a GNU extension.
     2000-12-15 11:48:05 -0800

   Alphabetic case is completely ignored in dates.  Comments may be
introduced between round parentheses, as long as included parentheses
are properly nested.  Hyphens not followed by a digit are currently
ignored.  Leading zeros on numbers are ignored.


automatically generated by info2www version 1.2.2.9