nirvn 617955ac1e [expression] Language support for format_date() and to_{date,datetime,time}()
By default, those expression use the application's locale. The addition of an optional
language parameter allows handling of dates that wouldn't match that default
locale (say for e.g. an English system running QGIS trying to transform a
French-formatted string into a date object).
2019-11-18 12:13:47 +07:00

16 lines
1011 B
Plaintext

{
"name": "to_datetime",
"type": "function",
"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 datetime"},
{"arg":"language","optional":true,"description":"language (lowercase, two- or three-letter, ISO 639 language code) used to convert the string into a datetime"}
],
"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"},
{ "expression":"to_datetime('29 juin, 2019 @ 12:34','d MMMM, yyyy @ HH:mm','fr')", "returns":"2019-06-29T12:34"}
]
}