LISTSERV Maestro 11.1-2 Help Table Of Contents

Calculation Formulas

Back to Calculation Formulas Overview
Back to Functions Overview


Function "IsDate"

IsDate(datetext, formatpattern [, localename | langcode, countrycode])

Function: Checks if the given format specifications can be used to correctly parse a numerical date/time value from the given "datetext" text argument. Returns "true" if a date/time value can be correctly parsed from the arguments, "false" if not.

This function is a companion function to ToMillis: If IsDate returns "true" for a given set of arguments, then it is safe to use ToMillis on the same set of arguments (i.e. ToMillis will not generate an error when used with the same arguments).

Please see here for details about how to write the format pattern.

Note: For formatting purposes, LISTSERV Maestro will by default use the U.S. locale and the time zone of the server where the LUI component is running. Therefore, locale specific texts, like weekday names, names of months, and so on, will be formatted using the U.S. locale. Similarly, times will be formatted using the server's time zone.

If you want to specify a different locale, you can do so with the optional parameter "localename" to choose a predefined locale or with the optional parameters "langcode" and "countrycode" to specify your own locale. See here for details.

If you want to specify the time as relative to a different time zone, you can include a time zone value in the date/time text.

Return-Type: Boolean

Arguments:
datetext - Type Text: The date/time text string to parse. Must contain the desired date/time in a textual format that can be parsed by applying the given format pattern.
formatpattern - Type Text: specifies the format pattern to use to parse the "datetext". Please see here for details about this format pattern.
 
(The following arguments are optional. Either you supply no further argument at all or you supply only the following argument)

localename - Type Text: A name of a predefined locale. See here for a list of available locale names. If specified, any locale specific text in "datetext" will be expected according to this locale.
 
(Or you supply both the following two Arguments)

langcode - Type Text: A lowercase two-letter ISO-639 language code specifying the language for the locale. For example, see here http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt for one list of the ISO-639 language codes.

countrycode - Type "Text": An uppercase two-letter ISO-3166 country code specifying the country for the locale. For example, see here http://www.iso.org/iso/country_codes/iso_3166_code_lists.htm for one list of the ISO-3316 country codes.

If "langcode" and "countrycode" are specified, they are used to create a locale for the given language and country, and any locale specific text in "datetext" will be expected according to this locale.

Examples:
IsDate("February 22. 2004", "MMMM dd. yyyy")
(parses the given date using the default U.S. locale)
IsDate("Februar 22. 2004", "MMMM dd. yyyy", "Germany")
(parses the given date using the pre-defined locale for Germany)
IsDate("februari 22. 2004", "MMMM dd. yyyy", "de", "AT")
(parses the given date using a custom locale for language "de" =German and country "AT" =Austria)

© 2002-2023 L-Soft Sweden AB. All rights reserved.