i18n.DateTimeFormat Extends
Construct a DateTimeFormat object based on current locale.

Inheritance

Constructor

goog.i18n.DateTimeFormat(patternopt_dateTimeSymbols)

Parameters

pattern : string | number
pattern specification or pattern type.
opt_dateTimeSymbols : !Object=
Optional symbols to use use for this instance rather than the global symbols.

Instance Methods

Public Protected Private
applyPattern_(pattern)
Apply specified pattern to this formatter object.
Arguments:
pattern : string
String specifying how the date should be formatted.
code »
applyStandardPattern_(formatType)
Apply a predefined pattern as identified by formatType, which is stored in locale specific repository.
Arguments:
formatType : number
A number that identified the predefined pattern.
code »
format(dateopt_timeZone) string
Format the given date object according to preset pattern and current lcoale.
Arguments:
date : goog.date.DateLike
The Date object that is being formatted.
opt_timeZone : goog.i18n.TimeZone=
optional, if specified, time related fields will be formatted based on its setting. When this field is not specified, "undefined" will be pass around and those function that really need time zone service will create a default one.
Returns: string  Formatted string for the given date. Throws an error if the date is null or if one tries to format a date-only object (for instance goog.date.Date) using a pattern with time fields.
code »
format0To11Hours_(countdate) string
Formats (0..11) Hours field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  formatted string that represent this field.
code »
format0To23Hours_(countdate) string
Formats (0..23) Hours field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  formatted string that represent this field.
code »
format1To12Hours_(countdate) string
Formats (1..12) Hours field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  formatted string that represent this field.
code »
format24Hours_(countdate) string
Formats (1..24) Hours field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats. This controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  Formatted string that represent this field.
code »
formatAmPm_(countdate) string
Formats Am/Pm field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  Formatted string that represent this field.
code »
formatDate_(countdate) string
Formats Date field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  Formatted string that represent this field.
code »
formatDayOfWeek_(countdate) string
Formats Day of week field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  Formatted string that represent this field.
code »
formatEra_(countdate) string
Formats Era field according to pattern specified.
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  Formatted string that represent this field.
code »
formatField_(patternStrdatedateForDatedateForTimeopt_timeZone) string
Formatting one date field.
Arguments:
patternStr : string
The pattern string for the field being formatted.
date : !goog.date.DateLike
represents the real date to be formatted.
dateForDate : !goog.date.DateLike
used to resolve date fields for formatting.
dateForTime : !goog.date.DateLike
used to resolve time fields for formatting.
opt_timeZone : goog.i18n.TimeZone=
This holds current time zone info.
Returns: string  string representation for the given field.
code »
formatFractionalSeconds_(countdate) string
Formats Fractional seconds field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  Formatted string that represent this field.
code »
formatMinutes_(countdate) string
Formats Minutes field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  Formatted string that represent this field.
code »
formatMonth_(countdate) string
Formats Month field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  Formatted string that represent this field.
code »
formatQuarter_(countdate) string
Formats Quarter field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  Formatted string that represent this field.
code »
formatSeconds_(countdate) string
Formats Seconds field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  Formatted string that represent this field.
code »
formatStandaloneDay_(countdate) string
Formats Standalone weekday field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  formatted string that represent this field.
code »
formatStandaloneMonth_(countdate) string
Formats Standalone Month field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  formatted string that represent this field.
code »
formatTimeZoneId_(dateopt_timeZone) string
Generate GMT timeZone string for given date
Arguments:
date : !goog.date.DateLike
Whose value being evaluated.
opt_timeZone : goog.i18n.TimeZone=
This holds current time zone info.
Returns: string  GMT timeZone string.
code »
formatTimeZoneRFC_(countdateopt_timeZone) string
Formats TimeZone field following RFC
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
opt_timeZone : goog.i18n.TimeZone=
This holds current time zone info.
Returns: string  Formatted string that represent this field.
code »
formatTimeZone_(countdateopt_timeZone) string
Generate GMT timeZone string for given date
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
Whose value being evaluated.
opt_timeZone : goog.i18n.TimeZone=
This holds current time zone info.
Returns: string  GMT timeZone string.
code »
formatWeekOfYear_(countdate) string
Formats the week of year field according to pattern specified
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  Formatted string that represent this field.
code »
formatYear_(countdate) string
Formats Year field according to pattern specified Javascript Date object seems incapable handling 1BC and year before. It can show you year 0 which does not exists. following we just keep consistent with javascript's toString method. But keep in mind those things should be unsupported.
Arguments:
count : number
Number of time pattern char repeats, it controls how a field should be formatted.
date : !goog.date.DateLike
It holds the date object to be formatted.
Returns: string  Formatted string that represent this field.
code »
localizeNumbers_(input) string
Localizes a string potentially containing numbers, replacing ASCII digits with native digits if specified so by the locale. Leaves other characters.
Arguments:
input : string
the string to be localized, using ASCII digits.
Returns: string  localized string, potentially using native digits.
code »

Instance Properties

dateTimeSymbols_ :
Data structure that with all the locale info needed for date formatting. (day/month names, most common patterns, rules for week-end, etc.)
Code »
patternParts_ :
No description.
Code »

Static Methods

goog.i18n.DateTimeFormat.localizeNumbers(inputopt_dateTimeSymbols) string
Localizes a string potentially containing numbers, replacing ASCII digits with native digits if specified so by the locale. Leaves other characters.
Arguments:
input : number | string
the string to be localized, using ASCII digits.
opt_dateTimeSymbols : !Object=
Optional symbols to use use rather than the global symbols.
Returns: string  localized string, potentially using native digits.
code »
goog.i18n.DateTimeFormat.validateDateHasTime_(date)
Validates is the goog.date.DateLike object to format has a time. DateLike means Date|goog.date.Date, and goog.date.DateTime inherits from goog.date.Date. But goog.date.Date does not have time related members (getHours, getMinutes, getSeconds). Formatting can be done, if there are no time placeholders in the pattern.
Arguments:
date : !goog.date.DateLike
the object to validate.
code »

Static Properties

goog.i18n.DateTimeFormat.TOKENS_ :
regular expression pattern for parsing pattern string
Code »

Enumerations

goog.i18n.DateTimeFormat.Format :
Enum to identify predefined Date/Time format pattern.
Constants:
FULL_DATE
No description.
FULL_DATETIME
No description.
FULL_TIME
No description.
LONG_DATE
No description.
LONG_DATETIME
No description.
LONG_TIME
No description.
MEDIUM_DATE
No description.
MEDIUM_DATETIME
No description.
MEDIUM_TIME
No description.
SHORT_DATE
No description.
SHORT_DATETIME
No description.
SHORT_TIME
No description.
Code »
goog.i18n.DateTimeFormat.PartTypes_ :
These are token types, corresponding to above token definitions.
Constants:
FIELD
No description.
LITERAL
No description.
QUOTED_STRING
No description.
Code »

Package i18n

Package Reference