Skip to main content
Skip table of contents

setDateParser

Creates a parser that can make Date values out of Strings.

Parsers can be used in the logic with the set command, and in document content with the content logic attribute.

Attributes

name

Required

Value type

EL-evaluated

Yes

String

Yes

Defines a name for the created parser. Other commands can choose to use this parser by referring to it by this name.

locale

Required

Value type

EL-evaluated

No

String

Yes

Specifies a locale for this parser, affecting the formatting rules. The resolved String should be an ISO-639 language code and an ISO-3166 country code, joined by a hyphen or an underscore (e.g. "en-US" or "en_US"). Alternatively the value may only specify the language code, but this may lead to unpredictable results if this parser requires the country information.

If not defined, the parser will follow the user's default locale.

pattern

Required

Value type

EL-evaluated

No

String

No

The value of this attribute is used as the pattern this parser uses to read Strings and form them into Date values.

If not defined, a locale-dependent standard pattern will be used.

timeZone

Required

Value type

EL-evaluated

No

String

Yes

Specifies the time zone that the Date values produced by this parser are on. Use time zone names like "Europe/London", "America/New_York" or "Etc/GMT+2" for example.

If not defined, the active user's time zone is used.

Examples

With Date parsers it is important to know which kinds of date Strings are being parsed, as something like "10.12.2017" can be easily interpreted specifying a date in December as well as October.

CODE
<setDateParser name="dayFirst" pattern="dd.MM.yyyy"><setDateParser name="monthFirst" pattern="MM.dd.yyyy">

With that String the parsing is actually successful with both formats, in the sense that a valid Date value can be produced in both cases. However, with a String specifying a date past the 12th of a month, such as "22/12/1990", interpreting the first value as the month would produce a parsing error as the month value cannot exceed 12.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.