Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can use uppercase or lowercase for all format codes except for months and minutes. 'M' must be used for months and 'm' must be used for minutes.

Locale

The The Locale parameter  parameter specifies the specific culture used to help render the final text. Omitting Omitting Locale or  or setting it "" causes the "Format" service to use the user's current Windows locale setting. If, however, you want to specify your own localization, set this parameter to a locale name. Locale names have a complex syntax that allow you to specify all manner of aspects, but in 99.99% of cases, you'll use the format "language-REGION". Here, language is a lowercase ISO 639-1 language code. REGION specifies an uppercase ISO 3166-1 country/region identifier. The region is optional. For example, the locale name for English is "en", the locale name for English (United States) is "en-US", and the locale name for Divehi (Maldives) is "dv-MV".

Here is a chart for the 200 most common languages and regions:

...

locale name.


Examples

Code Block
languagebp
// Create an OI datetime
Datetime = SRP_DateTime("Encode", 2020, 1, 14, 3, 7, 43)

// Format a datetime using the default format and the current locale
Text = SRP_DateTime("Format", Datetime)

// Format a datetime using the long format and the current locale
Text = SRP_DateTime("Format", Datetime, "Long")

// Format a datetime using the long format and the Spanish language
Text = SRP_DateTime("Format", Datetime, "Long", "es")

// Format a datetime using a custom format and the Spanish-MEXICAN language
Text = SRP_DateTime("Format", Datetime, "MMMM D, YYYY 'at' h:mm:ss tt", "es-MX")

...