You are here

date-argument.html in Date 7

Same filename and directory in other branches
  1. 6.2 help/date-argument.html

File

help/date-argument.html
View source
<p>The generic date argument is based on ISO 8601 date duration and time interval standards, and allows you to create an flexible argument for any date range for any date field.

</p><p>The argument expects a value like 2006-01-01--2006-01-15, or 2006-W24, or @P1W. Separate from and to dates or date and period with a double hyphen (--)

</p><p>From and to dates in argument are ISO dates, but can be shortened and missing parts will be added. Omitted parts of ISO dates will be assumed to be the first possible (for the from date) or the last possible (for the to date) value in that time period.

</p><p>The 'to' portion of the argument can be eliminated if it is the same as the 'from' portion Use @ instead of a date to substitute in the current date and time.

</p><p>Shortcuts are available:

</p><p>Use periods (P1H, P1D, P1W, P1M, P1Y) to get next hour/day/week/month/year from now. Use date before P sign to get next hour/day/week/month/year from that date. The ISO standard calls for a separator (--) between a date and the P, but the separator is optional between a start date and a period in this argument to make the result easier to read.

</p><p>Use format like 2006-W24 to find ISO week number 24 in year 2006.</p>
<h3>Examples:</h3>
<table border="1">  
<tr><th>ARGUMENT</th><th>RESULTING QUERY RANGE</th></tr>
<tr><td>2006-W24</td><td>24th ISO week in 2006</td>
</tr><tr><td>2006</td><td>the whole year of 2006</td>
</tr><tr><td>2006-03</td><td>the whole month of Mar 2006</td>
</tr><tr><td>2006-02--2007-03</td><td>Feb 1 2006 to Mar 31 2006</td>
</tr><tr><td>2006-08-31T14--2006-08-31T16</td><td>the 14th to 16th hours of Aug 8 2006</td>
</tr><tr><td>@--2006-12-31</td><td>NOW to 2006-12-31T23:59:59</td>
</tr><tr><td>@P3H</td><td>NOW to three hours from now</td>
</tr><tr><td>@P1Y90D</td><td>NOW to 1 year and 90 days from now</td>
</tr><tr><td>2006-03-05P1W</td><td>the week starting Mar 5 2006</td>
</tr><tr><td>2006-01P3M</td><td>3 months starting Jan 2006</td>
</tr></table>  

<p>See <a href="http://en.wikipedia.org/wiki/ISO_8601#Week_dates">http://en.wikipedia.org/wiki/ISO_8601#Week_dates</a> for definitions of ISO weeks See <a href="http://en.wikipedia.org/wiki/ISO_8601#Duration">http://en.wikipedia.org/wiki/ISO_8601#Duration</a> for definitions of ISO duration and time interval.

</p>