Versions Compared

Key

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

...

Suppose you want a very specific order. In that case, you can set Format to something like "MMMM D, YYYY". Remember, only order matters. If you used this format in the Format service, it would product "February 3, 2004." When you use this format in the Parse service, it can handle "February 3, 2004", "2/3/04", and anything else so long as the order is Month, Day, Year. Note, however, that locale still matters. If you set Format to "MMMM D, YYYY" and Locale to "es-ES", then "February 3, 2004" will fail to parse but "febrero 3, 2004" and "2/3/04" will succeed.

...

The parser will attempt to succeed in parsing a date time datetime even if you don't supply the entire order. The default order is always Year, Month, Day, Hour, Minute, and Second. If your format is just "D/M", then it will look for the day and month first, then it will look for the remaining components in the default order: Year, Hour, Minute, Second.

...

Code Block
languagebp
// Parse a datetime using the default format and the current locale as a guide
Datetime = SRP_DateTime("FormatParse", "1/14/2020 9:58 AM")

// Parse a datetime using the long format and the current locale as a guide
Datetime = SRP_DateTime("FormatParse", "Tuesday, January 14, 2020 9:58:22 AM", "Long")

// Parse a datetime using the long format and the Spanish language as a guide
Datetime = SRP_DateTime("FormatParse", "martes, 14 de enero de 2020 15:17:43", "Long", "es")

// Parse  a datetime using a custom format and the Spanish-MEXICAN language as a guide
Datetime = SRP_DateTime("FormatParse", "enero 14, 2020 at 3:17:43 p. m.", "MMMM D, YYYY 'at' h:mm:ss tt", "es-MX")

...