wwUtils::FormatValue

Uses the .NET ToString() formatting engine to format values to string. It'll use the current locale to display the values in the correct number and date formatting formats (ie. decimal separators, date number order for mdy, etc.).

This allows for sophisticated date and number formatting or provides access to special custom formatting available on miscellaneous objects.

For format reference refer to the MSDN docs for:

o.FormatValue(lvValue,lcFormatString)

Formatted string

Parameters

lvValue
The value to write out to string

lcFormatString
Any .NET format string that can be applied to the value.

Remarks

Uses .NET and wwDotnetBridge under the covers so make sure wwDotnetBridge and .NET 4.0 are available on the target machine.

Example


*** Data Formats

? FormatValue(DATETIME(),"")
* 6/6/2016 7:49:26 PM

lcFormat = "MMM dd, yyyy"
? FormatValue(DATETIME(),lcFormat)
* Jun 10, 2016


lcFormat = "MMMM dd, yyyy"
? FormatValue(DATETIME(),lcFormat)
* August 1, 2016

lcFormat = "HH:mm:ss"
? FormatValue(DATETIME(),lcFormat)
* 20:15:10

lcFormat = "h:m:s tt"
? FormatValue(DATETIME(),lcFormat)
* 8:5:10 PM

lcFormat = "r"  && Mime Date Time
? FormatValue(DATETIME(),lcFormat)
* Thu, 07 Mar 2019 09:55:34 GMT

lcFormat = "u"  && ISO time format Json/xml
? FormatValue(DATETIME(),lcFormat)
* 2019-03-07 09:55:51Z


*** Number Formats

? FormatValue(2,"00")
* 02

? FormatValue(12,"00")
* 12

? FormatValue(1233.22,"c")
* $1,233.22

? FormatValue(1233.2255,"n2")
* $1,233.23

See also

Class wwUtils