data/TWiki/TimeSpecifications.txt
changeset 0 414e01d06fd5
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/data/TWiki/TimeSpecifications.txt	Sat Jan 26 15:50:53 2008 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +%META:TOPICINFO{author="TWikiContributor" date="1111929255" format="1.0" version="1"}%
     1.5 +---++ Time Specifications
     1.6 +TWiki recognises the following formats for date/time strings. For all strings the time is optional.
     1.7 +   * 31 Dec 2001 - 23:59
     1.8 +   * 2001/12/31 23:59:59
     1.9 +   * 2001.12.31.23.59.59
    1.10 +   * 2001/12/31 23:59
    1.11 +   * 2001.12.31.23.59
    1.12 +   * =2001-12-31T23:59:59= - ISO 8601 format
    1.13 +ISO dates may have a timezone specifier, either Z or a signed difference
    1.14 +in hh:mm format. For example:
    1.15 +   * 2001-12-31T23:59:59+01:00
    1.16 +   * 2001-12-31T23:59Z
    1.17 +
    1.18 +---++ Time Intervals
    1.19 +
    1.20 +Some features of TWiki, such as searches, permit the specification of _time intervals_. A time interval is a period of time, such as "1337 to 1451" (the Hundred Years War) or "9th February 2005 to 26th March 2005" (the Christian season of Lent).
    1.21 +
    1.22 +The recognised format is a [[#RestrictedInterpretation][restricted]] interpretation of the [[http://www.iso.ch/iso/en/prods-services/popstds/datesandtime.html][ISO standard 8601]].
    1.23 +
    1.24 +A string is accepted as a valid time interval string if it conforms to the following grammar:
    1.25 +
    1.26 +<verbatim>
    1.27 +interval ::= date
    1.28 +           | date '/' date
    1.29 +           | 'P' duration '/' date
    1.30 +           | date '/' 'P' duration
    1.31 +           ;
    1.32 +
    1.33 +date ::= year ('-' month ('-' day ('T' hour (':' minute (':' second)))))
    1.34 +       | '$today'
    1.35 +       | '$now'
    1.36 +       ;
    1.37 +
    1.38 +duration ::= NUM unit
    1.39 +           | duration NUM unit
    1.40 +           ;
    1.41 +
    1.42 +unit ::= 'y' | 'm' | 'w' | 'd' | 'h' | 'M' | 'S'
    1.43 +
    1.44 +year, month, day, hour, minute, second ::= NUM
    1.45 +</verbatim>
    1.46 +
    1.47 +An incompletely specified date will be completed by including as much time as possible.
    1.48 +
    1.49 +For example, if the start of a date range is specified by just a year, e.g. =1999/2006=, it will be interpreted as starting at January 1st 1999, at zero hours zero minutes zero seconds. Similarly for the end of the range; =2006= will be interpreted as the last second of 2006.
    1.50 +
    1.51 +If only one date is specified (e.g. the interval string is =1999=) it will be treated as if the same date were the start and the end i.e. =1999-1999=. Thus =1999= is interpreted as the whole of the year 1999.
    1.52 +
    1.53 +| *You write* | *You mean* |
    1.54 +| =2003=                   | the whole year 2003 |
    1.55 +| =2003-03-28T/2003-05-15= | from March 28th to May 15th of the year 2003 |
    1.56 +| =P3w/$today=             | three weeks until today |
    1.57 +| 2003-12-12               | 12th Dec 2003, from 0:00 to 23:59:59 |
    1.58 +| 2003                     | any time in the year 2003 |
    1.59 +| 2003/P20w                | the first 20 weeks of the year 2003 |
    1.60 +| P20w/2003                | the last 20 weeks of the year 2003 |
    1.61 +| $today                   | any second during the present day |
    1.62 +| P2d/$today               | today and yesterday |
    1.63 +| P1d/$now                 | the last 24 hours |
    1.64 +| $now/P50y                | the next 50 years |
    1.65 +
    1.66 +Further examples can be seen [[http://www.iso.ch/iso/en/prods-services/popstds/datesandtime.html#three][here]].
    1.67 +
    1.68 +#RestrictedInterpretation
    1.69 +---+++ Limitations
    1.70 +
    1.71 +If you are entering a date at both ends of the time interval string, the end date must include all leading fields, even if these are the same as in the start date. This limitation forms a proper restriction to the ISO8601 standard. i.e. ISO8601 specifies that =2003-12-12/14= means 12th Dec 2003 00:00 to 14th Dec 2003 23:59:59. However this shorthand is not supported by TWiki and must be written as =2003-12-12/2003-12-14=