LISTSERV Maestro 11.1-3 Help Table Of Contents

Calculation Formulas

Back to Calculation Formulas Overview
Back to Functions Overview


Function "ToDateText"

ToDateText(datevalue, formatpattern, timezone [, localename | langcode, countrycode])

Function: Returns a formatted representation of a numerical date/time value, interpreted in the given timezone. The formatted representation is usually returned as type Text, but may also be returned as type Number, if applicable. The format that is used to create the representation is specified with the given format pattern argument.

Please read also about how to write the format pattern and about possible timezone values.

Note: For formatting purposes, LISTSERV Maestro will use the U.S. locale by default. Therefore, locale specific texts, like weekday names, names of months, and so on, will be formatted using the U.S. locale.

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.

Return-Type: Usually Text. However, may be Number, if the result can be expressed as a number.

Arguments:
datevalue - Type Number: The date/time value to format. Must contain the desired date/time represented as milliseconds since "Jan. 1st 1970, 00:00:00 GMT" (for example from the output of the functions "CurrentMillis", "SubscribeTimeMillis", "ToMillis", and "LastMidnightMillis").

formatpattern - Type Text: Specifies the format pattern to use to convert the milliseconds value in "datevalue" into the formatted representation. Please see here for details about this format pattern.

timezone - Type Text: The ID or value of the timezone that shall be used to format the date/time value. See here for possible timezone values.
 
(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 the formatted date/time representation will be given 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, then they are used to create a locale for the given language and country, and any locale specific text in the formatted date/time representation will be given according to this locale.

Examples:
ToDateText(CurrentMillis, "MMM dd. yyyy", "EST")
(formats the current date using Easter Standard Time and the default U.S. locale)

ToDateText(CurrentMillis, "MMM dd. yyyy", "CET", "Germany")
(formats the current date using Central European Time and the pre-defined locale for Germany)

ToDateText(CurrentMillis, "MMM dd. yyyy", "GMT+01:00", "de", "AT")
(formats the current date using a custom timezone offset that ignores daylight saving time and a custom locale for language "de" =German and country "AT" =Austria)

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