- Index
- »
- axon
- »
- func:format
def
func:format
format(val, pattern: null)
Format an object using the current locale and specified format pattern. Formatting patterns follow Fantom toLocale conventions:
Bool.toLocaleNumber.toLocaleDate.toLocaleTime.toLocaleDateTime.toLocaleIftoLocalemethod is found, then returnval.toStr
Examples:
123.456kW.format >> 123kW
123.456kW.format("#.0") >> 123.5kW
today().format("D-MMM-YYYY") >> 8-Feb-2023
today().format("DDD MMMM YYYY") >> 8th February 2023
now().format("D-MMM hh:mm") >> 08-Feb 14:50
now().format("DD/MM/YY k:mmaa") >> 08/02/23 2:50pm