Supports using SRP_DateTime in an OConv.

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

Returns

A formatted string containing a human readable datetime.

Remarks

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

Setting Format

If you want to set the format used to render the datetime, use OConv's branch option, which looks like this "[SRP_DATETIME,<branch>]". In this case, <branch> will be any value you would have passed to the Format 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 OConv 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

// Create an OI datetime
Datetime = SRP_DateTime("Encode", 2020, 1, 14, 3, 7, 43)
 
// OConv a datetime using the default format and the current locale
Text = OConv(Datetime, "[SRP_DATETIME]")
 
// OConv a datetime using the long format and the current locale
Text = OConv(Datetime, "[SRP_DATETIME,Long]")
 
// OConv a datetime using the long format and the Spanish language
Text = OConv(Datetime, "[SRP_DATETIME,(es)Long]")
 
// OConv a datetime using a custom format and the Spanish-MEXICAN language
Text = OConv(Datetime, "[SRP_DATETIME,(es-MX)MMMM D, YYYY 'at' h:mm:ss tt]")
  • No labels