mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Various fixes on date functions help
including replacement of todate and tointerval, use of third person conjugation and addition/fix of examples
This commit is contained in:
parent
45e847ef69
commit
f75a0cc4da
@ -4,7 +4,7 @@
|
||||
"description": "Returns the difference between two dates or datetimes.<br>The difference is returned as a <code>Interval</code> and needs to be used with one of the following functions in order to extract useful information:<br /><ul><li><code>year</code><li><code>month</code><li><code>week</code><li><code>day</code><li><code>hour</code><li><code>minute</code><li><code>second</code></ul>",
|
||||
"arguments": [ {"arg":"datetime1","description":"a string, date or datetime representing the later date"},
|
||||
{"arg":"datetime2","description":"a string, date or datetime representing the earlier date"}],
|
||||
"examples": [ { "expression":"age('2012-05-12','2012-05-2')", "returns":"interval", "note":"use <code>day</code> to extract number of days"},
|
||||
{ "expression":"day(age('2012-05-12','2012-05-2'))", "returns":"10"} ]
|
||||
"examples": [ { "expression":"day(age('2012-05-12','2012-05-02'))", "returns":"10"},
|
||||
{ "expression":"hour(age('2012-05-12','2012-05-02'))", "returns":"240"} ]
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,18 @@
|
||||
{
|
||||
"name": "day",
|
||||
"type": "function",
|
||||
"description": "Extract the day from a date, or the number of days from an interval.",
|
||||
"description": "Extracts the day from a date, or the number of days from an interval.",
|
||||
"variants": [
|
||||
{ "variant": "Date variant",
|
||||
"variant_description": "Extract the day from a date or datetime.",
|
||||
"variant_description": "Extracts the day from a date or datetime.",
|
||||
"arguments": [ {"arg":"date","description":"a date or datetime value"}],
|
||||
"examples": [ { "expression":"day('2012-05-12')", "returns":"12"}] },
|
||||
{
|
||||
"variant": "Interval variant",
|
||||
"variant_description": "Calculate the length in days of an interval.",
|
||||
"variant_description": "Calculates the length in days of an interval.",
|
||||
"arguments": [ {"arg":"interval","description":"interval value to return number of days from"}],
|
||||
"examples": [ { "expression":"day(tointerval('3 days'))", "returns":"3"},
|
||||
"examples": [ { "expression":"day(to_interval('3 days'))", "returns":"3"},
|
||||
{ "expression":"day(to_interval('3 weeks 2 days'))", "returns":"23"},
|
||||
{ "expression":"day(age('2012-01-01','2010-01-01'))", "returns":"730"}]
|
||||
}]
|
||||
}
|
||||
|
@ -3,6 +3,6 @@
|
||||
"type": "function",
|
||||
"description": "Returns the day of the week for a specified date or datetime. The returned value ranges from 0 to 6, where 0 corresponds to a Sunday and 6 to a Saturday.",
|
||||
"arguments": [ {"arg":"date","description":"date or datetime value"} ],
|
||||
"examples": [ { "expression":"day_of_week(todate('2015-09-21'))", "returns":"1"}
|
||||
"examples": [ { "expression":"day_of_week(to_date('2015-09-21'))", "returns":"1"}
|
||||
]
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "epoch",
|
||||
"type": "function",
|
||||
"description": "Return the interval in milliseconds between the unix epoch and a given date value.",
|
||||
"description": "Returns the interval in milliseconds between the unix epoch and a given date value.",
|
||||
"arguments": [ {"arg":"date","description":"a date or datetime value"} ],
|
||||
"examples": [ { "expression":"epoch(to_date('2017-01-01'))", "returns":"1483203600000"} ]
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "format_date",
|
||||
"type": "function",
|
||||
"description": "Format a date type or string into a custom string format. Uses Qt date/time format strings. See <a href='https://doc.qt.io/qt-5/qdatetime.html#toString'>QDateTime::toString</a>.",
|
||||
"description": "Formats a date type or string into a custom string format. Uses Qt date/time format strings. See <a href='https://doc.qt.io/qt-5/qdatetime.html#toString'>QDateTime::toString</a>.",
|
||||
"arguments": [
|
||||
{"arg":"datetime","description":"date, time or datetime value"},
|
||||
{"arg":"format","description":"String template used to format the string. <table><thead><tr><th>Expression</th><th>Output</th></tr></thead><tr valign=\"top\"><td>d</td><td>the day as number without a leading zero (1 to 31)</td></tr><tr valign=\"top\"><td>dd</td><td>the day as number with a leading zero (01 to 31)</td></tr><tr valign=\"top\"><td>ddd</td><td>the abbreviated localized day name (e.g. 'Mon' to 'Sun')</td></tr><tr valign=\"top\"><td>dddd</td><td>the long localized day name (e.g. 'Monday' to 'Sunday')</td></tr><tr valign=\"top\"><td>M</td><td>the month as number without a leading zero (1-12)</td></tr><tr valign=\"top\"><td>MM</td><td>the month as number with a leading zero (01-12)</td></tr><tr valign=\"top\"><td>MMM</td><td>the abbreviated localized month name (e.g. 'Jan' to 'Dec')</td></tr><tr valign=\"top\"><td>MMMM</td><td>the long localized month name (e.g. 'January' to 'December')</td></tr><tr valign=\"top\"><td>yy</td><td>the year as two digit number (00-99)</td></tr><tr valign=\"top\"><td>yyyy</td><td>the year as four digit number</td></tr></table><p>These expressions may be used for the time part of the format string:</p><table><thead><tr><th>Expression</th><th>Output</th></tr></thead><tr valign=\"top\"><td>h</td><td>the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)</td></tr><tr valign=\"top\"><td>hh</td><td>the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)</td></tr><tr valign=\"top\"><td>H</td><td>the hour without a leading zero (0 to 23, even with AM/PM display)</td></tr><tr valign=\"top\"><td>HH</td><td>the hour with a leading zero (00 to 23, even with AM/PM display)</td></tr><tr valign=\"top\"><td>m</td><td>the minute without a leading zero (0 to 59)</td></tr><tr valign=\"top\"><td>mm</td><td>the minute with a leading zero (00 to 59)</td></tr><tr valign=\"top\"><td>s</td><td>the second without a leading zero (0 to 59)</td></tr><tr valign=\"top\"><td>ss</td><td>the second with a leading zero (00 to 59)</td></tr><tr valign=\"top\"><td>z</td><td>the milliseconds without leading zeroes (0 to 999)</td></tr><tr valign=\"top\"><td>zzz</td><td>the milliseconds with leading zeroes (000 to 999)</td></tr><tr valign=\"top\"><td>AP or A</td><td>interpret as an AM/PM time. <i>AP</i> must be either \"AM\" or \"PM\".</td></tr><tr valign=\"top\"><td>ap or a</td><td>Interpret as an AM/PM time. <i>ap</i> must be either \"am\" or \"pm\".</td></tr></table>"}
|
||||
|
@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "hour",
|
||||
"type": "function",
|
||||
"description": "Extract the hour part from a datetime or time, or the number of hours from an interval.",
|
||||
"description": "Extracts the hour part from a datetime or time, or the number of hours from an interval.",
|
||||
"variants": [
|
||||
{ "variant": "Time variant",
|
||||
"variant_description": "Extract the hour part from a time or datetime.",
|
||||
"variant_description": "Extracts the hour part from a time or datetime.",
|
||||
"arguments": [ {"arg":"datetime","description":"a time or datetime value"}],
|
||||
"examples": [ { "expression":"hour('2012-07-22T13:24:57')", "returns":"13"}] },
|
||||
{
|
||||
"variant": "Interval variant",
|
||||
"variant_description": "Calculate the length in hours of an interval.",
|
||||
"variant_description": "Calculates the length in hours of an interval.",
|
||||
"arguments": [ {"arg":"interval","description":"interval value to return number of hours from"}],
|
||||
"examples": [ { "expression":"hour(tointerval('3 hours'))", "returns":"3"},
|
||||
{ "expression":"hour(age('2012-07-22T13:00:00','2012-07-22T10:00:00'))", "returns":"3"},
|
||||
|
@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "minute",
|
||||
"type": "function",
|
||||
"description": "Extract the minutes part from a datetime or time, or the number of minutes from an interval.",
|
||||
"description": "Extracts the minutes part from a datetime or time, or the number of minutes from an interval.",
|
||||
"variants": [
|
||||
{ "variant": "Time variant",
|
||||
"variant_description": "Extract the minutes part from a time or datetime.",
|
||||
"variant_description": "Extracts the minutes part from a time or datetime.",
|
||||
"arguments": [ {"arg":"datetime","description":"a time or datetime value"}],
|
||||
"examples": [ { "expression":"minute('2012-07-22T13:24:57')", "returns":"24"}] },
|
||||
{
|
||||
"variant": "Interval variant",
|
||||
"variant_description": "Calculate the length in minutes of an interval.",
|
||||
"variant_description": "Calculates the length in minutes of an interval.",
|
||||
"arguments": [ {"arg":"interval","description":"interval value to return number of minutes from"}],
|
||||
"examples": [ { "expression":"minute(tointerval('3 minutes'))", "returns":"3"},
|
||||
{ "expression":"minute(age('2012-07-22T00:20:00','2012-07-22T00:00:00'))", "returns":"20"},
|
||||
|
@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "month",
|
||||
"type": "function",
|
||||
"description": "Extract the month part from a date, or the number of months from an interval.",
|
||||
"description": "Extracts the month part from a date, or the number of months from an interval.",
|
||||
"variants": [
|
||||
{ "variant": "Date variant",
|
||||
"variant_description": "Extract the month part from a date or datetime.",
|
||||
"variant_description": "Extracts the month part from a date or datetime.",
|
||||
"arguments": [ {"arg":"date","description":"a date or datetime value"}],
|
||||
"examples": [ { "expression":"month('2012-05-12')", "returns":"05"}] },
|
||||
{
|
||||
"variant": "Interval variant",
|
||||
"variant_description": "Calculate the length in months of an interval.",
|
||||
"variant_description": "Calculates the length in months of an interval.",
|
||||
"arguments": [ {"arg":"interval","description":"interval value to return number of months from"}],
|
||||
"examples": [ { "expression":"month(to_interval('3 months'))", "returns":"3"},
|
||||
{ "expression":"month(age('2012-01-01','2010-01-01'))", "returns":"4.03333"}]
|
||||
|
@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "second",
|
||||
"type": "function",
|
||||
"description": "Extract the seconds part from a datetime or time, or the number of seconds from an interval.",
|
||||
"description": "Extracts the seconds part from a datetime or time, or the number of seconds from an interval.",
|
||||
"variants": [
|
||||
{ "variant": "Time variant",
|
||||
"variant_description": "Extract the seconds part from a time or datetime.",
|
||||
"variant_description": "Extracts the seconds part from a time or datetime.",
|
||||
"arguments": [ {"arg":"datetime","description":"a time or datetime value"}],
|
||||
"examples": [ { "expression":"second('2012-07-22T13:24:57')", "returns":"57"}] },
|
||||
{
|
||||
"variant": "Interval variant",
|
||||
"variant_description": "Calculate the length in seconds of an interval.",
|
||||
"variant_description": "Calculates the length in seconds of an interval.",
|
||||
"arguments": [ {"arg":"interval","description":"interval value to return number of seconds from"}],
|
||||
"examples": [ { "expression":"second(age('2012-07-22T00:20:00','2012-07-22T00:00:00'))", "returns":"1200"},
|
||||
{ "expression":"second(age('2012-01-01','2010-01-01'))", "returns":"63072000"}]
|
||||
|
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "to_date",
|
||||
"type": "function",
|
||||
"description": "Convert a string into a date object. An optional format string can be provided to parse the string; see <a href='https://doc.qt.io/qt-5/qdate.html#fromString-1'>QDate::fromString</a> for additional documentation on the format.",
|
||||
"arguments": [
|
||||
"description": "Converts a string into a date object. An optional format string can be provided to parse the string; see <a href='https://doc.qt.io/qt-5/qdate.html#fromString-1'>QDate::fromString</a> for additional documentation on the format.",
|
||||
"arguments": [
|
||||
{"arg":"string","description":"string representing a date value"},
|
||||
{"arg":"format","optional":true,"description":"format used to convert the string into a date"}
|
||||
],
|
||||
"examples": [
|
||||
"examples": [
|
||||
{ "expression":"to_date('2012-05-04')", "returns":"2012-05-04"},
|
||||
{ "expression":"to_date('June 29, 2019','MMMM d, yyyy')", "returns":"2019-06-29"}
|
||||
]
|
||||
|
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "to_datetime",
|
||||
"type": "function",
|
||||
"description": "Convert a string into a datetime object. An optional format string can be provided to parse the string; see <a href='https://doc.qt.io/qt-5/qdatetime.html#fromString-1'>QDateTime::fromString</a> for additional documentation on the format.",
|
||||
"arguments": [
|
||||
"description": "Converts a string into a datetime object. An optional format string can be provided to parse the string; see <a href='https://doc.qt.io/qt-5/qdatetime.html#fromString-1'>QDateTime::fromString</a> for additional documentation on the format.",
|
||||
"arguments": [
|
||||
{"arg":"string","description":"string representing a datetime value"},
|
||||
{"arg":"format","optional":true,"description":"format used to convert the string into a date"}
|
||||
],
|
||||
"examples": [
|
||||
"examples": [
|
||||
{ "expression":"to_datetime('2012-05-04 12:50:00')", "returns":"2012-05-04T12:50:00"},
|
||||
{ "expression":"to_datetime('June 29, 2019 @ 12:34','MMMM d, yyyy @ HH:mm')", "returns":"2019-06-29T12:34"}
|
||||
]
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "to_interval",
|
||||
"type": "function",
|
||||
"description": "Converts a string to a interval type. Can be used to take days, hours, month, etc of a date.",
|
||||
"description": "Converts a string to a interval type. Can be used to take days, hours, month, etc of a date.",
|
||||
"arguments": [ {"arg":"string","description":"a string representing an interval. Allowable formats include {n} days {n} hours {n} months."}],
|
||||
"examples": [ { "expression":"to_datetime('2012-05-05 12:00:00') - to_interval('1 day 2 hours')", "returns":"2012-05-04T10:00:00"}
|
||||
]
|
||||
|
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "to_time",
|
||||
"type": "function",
|
||||
"description": "Convert a string into a time object. An optional format string can be provided to parse the string; see <a href='https://doc.qt.io/qt-5/qtime.html#fromString-1'>QTime::fromString</a> for additional documentation on the format.",
|
||||
"arguments": [
|
||||
"description": "Converts a string into a time object. An optional format string can be provided to parse the string; see <a href='https://doc.qt.io/qt-5/qtime.html#fromString-1'>QTime::fromString</a> for additional documentation on the format.",
|
||||
"arguments": [
|
||||
{"arg":"string","description":"string representing a time value"},
|
||||
{"arg":"format","optional":true,"description":"format used to convert the string into a date"}
|
||||
],
|
||||
"examples": [
|
||||
"examples": [
|
||||
{ "expression":"to_time('12:30:01')", "returns":"12:30:01"},
|
||||
{ "expression":"to_time('12:34','HH:mm')", "returns":"12:34:00"}
|
||||
]
|
||||
|
@ -1,17 +1,17 @@
|
||||
{
|
||||
"name": "week",
|
||||
"type": "function",
|
||||
"description": "Extract the week number from a date, or the number of weeks from an interval.",
|
||||
"description": "Extracts the week number from a date, or the number of weeks from an interval.",
|
||||
"variants": [
|
||||
{ "variant": "Date variant",
|
||||
"variant_description": "Extract the week number from a date or datetime.",
|
||||
"variant_description": "Extracts the week number from a date or datetime.",
|
||||
"arguments": [ {"arg":"date","description":"a date or datetime value"}],
|
||||
"examples": [ { "expression":"week('2012-05-12')", "returns":"19"}] },
|
||||
{
|
||||
"variant": "Interval variant",
|
||||
"variant_description": "Calculate the length in weeks of an interval.",
|
||||
"variant_description": "Calculates the length in weeks of an interval.",
|
||||
"arguments": [ {"arg":"interval","description":"interval value to return number of months from"}],
|
||||
"examples": [ { "expression":"week(tointerval('3 weeks'))", "returns":"3"},
|
||||
"examples": [ { "expression":"week(to_interval('3 weeks'))", "returns":"3"},
|
||||
{ "expression":"week(age('2012-01-01','2010-01-01'))", "returns":"104.285"}]
|
||||
}]
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "year",
|
||||
"type": "function",
|
||||
"description": "Extract the year part from a date, or the number of years from an interval.",
|
||||
"description": "Extracts the year part from a date, or the number of years from an interval.",
|
||||
"variants": [
|
||||
{ "variant": "Date variant",
|
||||
"variant_description": "Extract the year part from a date or datetime.",
|
||||
"variant_description": "Extracts the year part from a date or datetime.",
|
||||
"arguments": [ {"arg":"date","description":"a date or datetime value"}],
|
||||
"examples": [ { "expression":"year('2012-05-12')", "returns":"2012"}] },
|
||||
{
|
||||
"variant": "Interval variant",
|
||||
"variant_description": "Calculate the length in years of an interval.",
|
||||
"variant_description": "Calculates the length in years of an interval.",
|
||||
"arguments": [ {"arg":"interval","description":"interval value to return number of years from"}],
|
||||
"examples": [ { "expression":"year(to_interval('3 years'))", "returns":"3"},
|
||||
{ "expression":"year(age('2012-01-01','2010-01-01'))", "returns":"1.9986"}]
|
||||
|
Loading…
x
Reference in New Issue
Block a user