Supports using SRP_DateTime in an IConv.

Datetime = IConv(String, "[SRP_DATETIME]")

Returns

A datetime in OI internal format.

Remarks

The "IConv" service adds support for using SRP_DateTime as a custom converter in IConv. All you have to do is set the IConv Conversion parameter to "[SRP_DATETIME]" and your data will be parsed using the default format for the user's current Windows locale settings.

Setting Format

If you want to set a format to guide the parsing process as explained in the Parse service, use IConv's branch option, which looks like this "[SRP_DATETIME,<branch>]". In this case, <branch> will be any value you would have passed to the Parse service's Format parameter. For example, you can use "[SRP_DATETIME,Long]" to use the culture's long format, or "[SRP_DATETIME,MM/DD/YYYY h:mm:ss tt]" to set a custom format.

Setting Locale

If you want to set a locale, you can do it in the IConv branch by placing the locale name in parenthesis at the beginning of the branch. For example, "[SRP_DATETIME,(es-MX)Long]" sets the format to "Long" and locale to Spanish (Mexico). When you omit the locale, the user's current Windows culture is used.

If you need parenthesis in the format but don't want to specify a locale, you must prefix the branch with an empty parenthetical such as "[SRP_DATETIME,()(MM/DD/YYYY) (hh:mm:ss)]"

Examples

// IConv a datetime using the default format and the current locale as a guide
Datetime = IConv("1/14/2020 9:58 AM", "[SRP_DATETIME]")

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

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

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