Login Register Help
API Documentation
Choose a stylesheet:

Functiondojo.date.locale.format (returns String)

Create a string from a Date object using a known localized pattern. By default, this method formats both date and time from dateObject. Formatting patterns are chosen appropriate to the locale. Different formatting lengths may be chosen, with “full” used by default. Custom patterns may be used or registered with translations using the dojo.date.locale.addCustomFormats method. Formatting patterns are implemented using the syntax described at unicode.org

parametertypedescription
dateObjectDatethe date and/or time to be formatted. If a time only is formatted, the values in the year, month, and day fields are irrelevant. The opposite is true when formatting only dates.
optionsdojo.date.locale.__FormatOptionsOptional.
fieldtypedescription
amStringoverride strings for am in times
datePatternStringoverride pattern with this string
formatLengthStringchoice of long, short, medium or full (plus any custom additions). Defaults to 'short'
fullYearBoolean(format only) use 4 digit years whenever 2 digit years are called for
localeStringoverride the locale used to determine formatting rules
pmStringoverride strings for pm in times
selectorStringchoice of 'time','date' (default: date and time)
strictBoolean(parse only) strict parsing, off by default
timePatternStringoverride pattern with this string

Usage

var foo: String=dojo.date.locale.format(dateObject: Date, options: dojo.date.locale.__FormatOptions?);