create date strict(adjustable template)
This function parses a text a using template b and creates a timestamp from it.
An optional locale d can modify the parsing behaviour for month names and day names.
Parameters
Parameter |
Description |
a |
The text to be interpreted. If a string cannot be interpreted with the format template b, an error occurs and parameter c controls the further behaviour of the function. |
b |
Format template. Important note: If the string in a is shorter than the template in b, b is shortened to the length of a. Please note that in rare cases this can lead to loss of accuracy or invalid values and consequential errors. Special case W3CDTF: This format template does not consist of placeholders. Therefore, no shortening is done. The format does not contain month names or day names. Therefore, no locale is used (parameter d). |
c |
(optional) Behaviour of function in case a text cannot be parsed as a date. Possible values see below. See also parameter a. Default: "empty". |
d |
(optional) Locale. Default: System locale. Example: "de_DE". Note: Use the three dots to select a value. |
e |
(optional) Timezone. Default: System timezone. Example: "UTC". |
Possible values for parameter "c"
Value |
Behaviour of function |
now |
The current date will be returned. |
empty |
The Empty Flag is set. Internally, the field also receives the current date. However, because of the Empty Flag, the value is not visible. |
error |
The function terminates with an error. |
Other value |
Instead of the input value, this value will be used. If this value cannot be parsed with b either, the function will terminate with an error. |
Examples
Current date of the example: "2011-10-20 15:33:23".
The system has the timezone "Europe/Berlin".
Note: "No date" cannot be interpreted as a timestamp with any format template b and thus triggers an error. The further behaviour of the function is then controlled with parameter c.
Parameter a |
b |
c |
d |
e |
Result |
Result of function "get empty flag()" |
241205 |
ddMMyyHHmm |
error |
|
|
2005-12-24 00:00:00.0 |
false |
No date |
ddMMyyHHmm |
error |
|
|
The function terminates with an error. |
|
No date |
ddMMyyHHmm |
now |
|
|
2011-10-20 15:33:23.0 |
false |
No date |
ddMMyyHHmm |
empty |
|
|
See description of "empty" for parameter c above. |
true |
No date |
ddMMyyHHmm |
231010 |
|
|
2010-10-23 00:00:00.0 |
false |
2412050820 |
ddMMyyHHmm |
error |
|
|
2005-12-24 08:20:00.0 |
false |
9-дек-2012 |
d-MMM-yyyy |
empty |
ru |
|
2012-12-09 00:00:00.0 |
false |
10.Dez 2012 |
dd.MMM yyyy |
empty |
de_DE |
|
2012-12-10 00:00:00.0 |
false |
1997-07-16T19:20:30Z (see format template "W3CDTF") |
W3C |
now |
|
|
1997-07-16 21:20:30.0 |
false |
31.03.2024 02:30:00 |
dd.MM.yyyy HH:mm:ss |
|
|
|
The current date with set Empty Flag. |
true |
31.03.2024 02:30:00 |
dd.MM.yyyy HH:mm:ss |
|
|
UTC |
2024-03-31 04:30:00.0 |
false |