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.FormatDate(ltDate,lcFormatString)

Return Value

Formatted string

Parameters

ltDate
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)
* 8:5:10 PM

lcFormat = "u"  && ISO time format Json/xml
? FormatValue(DATETIME(),lcFormat)
* 8:5:10 PM


*** 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 | wwUtils::FormatString

© West Wind Technologies, 1996-2018 • Updated: 06/06/16
Comment or report problem with topic