date.UtcDateTime Extends goog.date.DateTime
Class representing a date/time in GMT+0 time zone, without daylight saving. Defaults to current date and time if none is specified. The get... and the getUTC... methods are equivalent.

Inheritance

Constructor

goog.date.UtcDateTime(opt_yearopt_monthopt_dateopt_hoursopt_minutesopt_secondsopt_milliseconds)

Parameters

opt_year : number | Object=
Four digit UTC year or a date-like object. If not set, the created object will contain the date determined by goog.now().
opt_month : number=
UTC month, 0 = Jan, 11 = Dec.
opt_date : number=
UTC date of month, 1 - 31.
opt_hours : number=
UTC hours, 0 - 23.
opt_minutes : number=
UTC minutes, 0 - 59.
opt_seconds : number=
UTC seconds, 0 - 59.
opt_milliseconds : number=
UTC milliseconds, 0 - 999.

Instance Methods

Public Protected Private
add()
No description.
code »
clone() !goog.date.UtcDateTime
Clones the UtcDateTime object.
Returns: !goog.date.UtcDateTime  A clone of the datetime object.
code »
getTimezoneOffset()
No description.
code »
add(interval)
Performs date calculation by adding the supplied interval to the date.
Arguments:
interval : goog.date.Interval
Date interval to add.
code »
clone() !goog.date.DateTime
No description.
Returns: !goog.date.DateTime  A clone of the datetime object.
code »
equals(other) boolean
Tests whether given datetime is exactly equal to this DateTime.
Arguments:
other : goog.date.Date
The datetime to compare.
Returns: boolean  Whether the given datetime is exactly equal to this one.
code »
getHours() number
Returns the hours part of the datetime.
Returns: number  An integer between 0 and 23, representing the hour.
code »
getMilliseconds() number
Returns the milliseconds part of the datetime.
Returns: number  An integer between 0 and 999, representing the milliseconds.
code »
getMinutes() number
Returns the minutes part of the datetime.
Returns: number  An integer between 0 and 59, representing the minutes.
code »
getSeconds() number
Returns the seconds part of the datetime.
Returns: number  An integer between 0 and 59, representing the seconds.
code »
getUTCDay() goog.date.weekDay
Returns the day of week according to universal time, US style.
Returns: goog.date.weekDay  Day of week, 0 = Sun, 1 = Mon, 6 = Sat.
code »
getUTCHours() number
Returns the hours part of the datetime according to universal time.
Returns: number  An integer between 0 and 23, representing the hour.
code »
getUTCMilliseconds() number
Returns the milliseconds part of the datetime according to universal time.
Returns: number  An integer between 0 and 999, representing the milliseconds.
code »
getUTCMinutes() number
Returns the minutes part of the datetime according to universal time.
Returns: number  An integer between 0 and 59, representing the minutes.
code »
getUTCSeconds() number
Returns the seconds part of the datetime according to universal time.
Returns: number  An integer between 0 and 59, representing the seconds.
code »
isMidnight() boolean
No description.
Returns: boolean  Whether the datetime is aligned to midnight.
code »
setHours(hours)
Sets the hours part of the datetime.
Arguments:
hours : number
An integer between 0 and 23, representing the hour.
code »
setMilliseconds(ms)
Sets the seconds part of the datetime.
Arguments:
ms : number
Integer between 0 and 999, representing the milliseconds.
code »
setMinutes(minutes)
Sets the minutes part of the datetime.
Arguments:
minutes : number
Integer between 0 and 59, representing the minutes.
code »
setSeconds(seconds)
Sets the seconds part of the datetime.
Arguments:
seconds : number
Integer between 0 and 59, representing the seconds.
code »
setUTCHours(hours)
Sets the hours part of the datetime according to universal time.
Arguments:
hours : number
An integer between 0 and 23, representing the hour.
code »
setUTCMilliseconds(ms)
Sets the seconds part of the datetime according to universal time.
Arguments:
ms : number
Integer between 0 and 999, representing the milliseconds.
code »
setUTCMinutes(minutes)
Sets the minutes part of the datetime according to universal time.
Arguments:
minutes : number
Integer between 0 and 59, representing the minutes.
code »
setUTCSeconds(seconds)
Sets the seconds part of the datetime according to universal time.
Arguments:
seconds : number
Integer between 0 and 59, representing the seconds.
code »
toIsoString(opt_verboseopt_tz) string
Returns ISO 8601 string representation of date/time.
Arguments:
opt_verbose : boolean=
Whether the verbose format should be used instead of the default compact one.
opt_tz : boolean=
Whether the timezone offset should be included in the string.
Returns: string  ISO 8601 string representation of date/time.
code »
toIsoTimeString(opt_showSeconds) string
Generates time label for the datetime in standard ISO 24-hour time format. E.g., '06:00:00' or '23:30:15'.
Arguments:
opt_showSeconds : boolean=
Whether to shows seconds. Defaults to TRUE.
Returns: string  The time label.
code »
toString() string
Overloaded toString method for object.
Returns: string  ISO 8601 string representation of date/time.
code »
toUTCIsoString(opt_verboseopt_tz) string
Returns ISO 8601 string representation of date/time according to universal time.
Arguments:
opt_verbose : boolean=
Whether the opt_verbose format should be returned instead of the default compact one.
opt_tz : boolean=
Whether the the timezone offset should be included in the string.
Returns: string  ISO 8601 string representation of date/time according to universal time.
code »
toUsTimeString(opt_padHoursopt_showAmPmopt_omitZeroMinutes) string
Generates time label for the datetime, e.g., '5:30am'. By default this does not pad hours (e.g., to '05:30') and it does add an am/pm suffix. TODO(user): i18n -- hardcoding time format like this is bad. E.g., in CJK locales, need Chinese characters for hour and minute units.
Arguments:
opt_padHours : boolean=
Whether to pad hours, e.g., '05:30' vs '5:30'.
opt_showAmPm : boolean=
Whether to show the 'am' and 'pm' suffix.
opt_omitZeroMinutes : boolean=
E.g., '5:00pm' becomes '5pm', but '5:01pm' remains '5:01pm'.
Returns: string  The time label.
code »
toXmlDateTime(opt_timezone) string
Returns XML Schema 2 string representation of date/time. The return value is also ISO 8601 compliant.
Arguments:
opt_timezone : boolean=
Should the timezone offset be included in the string?.
Returns: string  XML Schema 2 string representation of date/time.
code »
Defined in goog.date.Date
add(interval)
Performs date calculation by adding the supplied interval to the date.
Arguments:
interval : goog.date.Interval
Date interval to add.
code »
buildDate_(fullYearmonthdate) !Date
new Date(y, m, d) treats years in the interval [0, 100) as two digit years, adding 1900 to them. This method ensures that calling the date constructor as a copy constructor returns a value that is equal to the passed in date value by explicitly setting the full year.
Arguments:
fullYear : number
The full year (including century).
month : number
The month, from 0-11.
date : number
The day of the month.
Returns: !Date  The constructed Date object.
code »
clone() !goog.date.Date
No description.
Returns: !goog.date.Date  A clone of the date object.
code »
equals(other) boolean
Tests whether given date is equal to this Date. Note: This ignores units more precise than days (hours and below) and also ignores timezone considerations.
Arguments:
other : goog.date.Date
The date to compare.
Returns: boolean  Whether the given date is equal to this one.
code »
getDate() number
No description.
Returns: number  The date of month.
code »
getDay() goog.date.weekDay
No description.
Returns: goog.date.weekDay  The day of week, US style. 0 = Sun, 6 = Sat.
code »
getDayOfYear() number
No description.
Returns: number  The day of year.
code »
getFirstDayOfWeek() number
No description.
Returns: number  The first day of the week. 0 = Mon, 6 = Sun.
code »
getFirstWeekCutOffDay() number
No description.
Returns: number  The cut off weekday used for week number calculations. 0 = Mon, 6 = Sun.
code »
getFullYear() number
No description.
Returns: number  The four digit year of date.
code »
getIsoWeekday() number
No description.
Returns: number  The day of week, ISO style. 0 = Mon, 6 = Sun.
code »
getMonth() goog.date.month
No description.
Returns: goog.date.month  The month of date, 0 = Jan, 11 = Dec.
code »
getNumberOfDaysInMonth() number
No description.
Returns: number  The number of days for the selected month.
code »
getTime() number
Returns the number of milliseconds since 1 January 1970 00:00:00.
Returns: number  The number of milliseconds since 1 January 1970 00:00:00.
code »
getTimezoneOffset() number
Returns timezone offset. The timezone offset is the delta in minutes between UTC and your local time. E.g., UTC+10 returns -600. Daylight savings time prevents this value from being constant.
Returns: number  The timezone offset.
code »
getTimezoneOffsetString() string
Returns timezone offset as a string. Returns offset in [+-]HH:mm format or Z for UTC.
Returns: string  The timezone offset as a string.
code »
getUTCDate() number
No description.
Returns: number  The date of month according to universal time.
code »
getUTCDay() goog.date.weekDay
No description.
Returns: goog.date.weekDay  The day of week according to universal time, US style. 0 = Sun, 1 = Mon, 6 = Sat.
code »
getUTCFullYear() number
No description.
Returns: number  The four digit year of date according to universal time.
code »
getUTCHours() number
No description.
Returns: number  The hours value according to universal time.
code »
getUTCIsoWeekday() number
No description.
Returns: number  The day of week according to universal time, ISO style. 0 = Mon, 6 = Sun.
code »
getUTCMinutes() number
No description.
Returns: number  The hours value according to universal time.
code »
getUTCMonth() goog.date.month
No description.
Returns: goog.date.month  The month of date according to universal time, 0 = Jan, 11 = Dec.
code »
getUTCWeekday() number
No description.
Returns: number  The day of week according to universal time and firstDayOfWeek setting.
code »
getWeekNumber() number
No description.
Returns: number  The week number.
code »
getWeekday() number
No description.
Returns: number  The day of week according to firstDayOfWeek setting.
code »
getYear() number
Alias for getFullYear.
Returns: number  The four digit year of date.
code »
maybeFixDst_(expected)
Fixes date to account for daylight savings time in browsers that fail to do so automatically.
Arguments:
expected : number
Expected date.
code »
set(date)
Sets the date.
Arguments:
date : goog.date.Date
Date object to set date from.
code »
setDate(date)
Sets the day part of the date.
Arguments:
date : number
The day part.
code »
setFirstDayOfWeek(day)
Sets the first day of week.
Arguments:
day : number
0 = Mon, 6 = Sun.
code »
setFirstWeekCutOffDay(day)
Sets cut off weekday used for week number calculations. 0 = Mon, 6 = Sun.
Arguments:
day : number
The cut off weekday.
code »
setFullYear(year)
Sets the year part of the date.
Arguments:
year : number
Four digit year.
code »
setMonth(month)
Sets the month part of the date. TODO(nnaze): Update type to goog.date.month.
Arguments:
month : number
The month, where 0 = Jan, 11 = Dec.
code »
setTime(ms)
Sets the value of the date object as expressed in the number of milliseconds since 1 January 1970 00:00:00.
Arguments:
ms : number
Number of milliseconds since 1 Jan 1970.
code »
setUTCDate(date)
Sets the day part of the date according to universal time.
Arguments:
date : number
The UTC date.
code »
setUTCFullYear(year)
Sets the year part of the date according to universal time.
Arguments:
year : number
Four digit year.
code »
setUTCMonth(month)
Sets the month part of the date according to universal time.
Arguments:
month : number
The month, where 0 = Jan, 11 = Dec.
code »
setYear(year)
Alias for setFullYear.
Arguments:
year : number
Four digit year.
code »
toIsoString(opt_verboseopt_tz) string
Returns ISO 8601 string representation of date.
Arguments:
opt_verbose : boolean=
Whether the verbose format should be used instead of the default compact one.
opt_tz : boolean=
Whether the timezone offset should be included in the string.
Returns: string  ISO 8601 string representation of date.
code »
toString() string
Overloaded toString method for object.
Returns: string  ISO 8601 string representation of date.
code »
toUTCIsoString(opt_verboseopt_tz) string
Returns ISO 8601 string representation of date according to universal time.
Arguments:
opt_verbose : boolean=
Whether the verbose format should be used instead of the default compact one.
opt_tz : boolean=
Whether the timezone offset should be included in the string.
Returns: string  ISO 8601 string representation of date according to universal time.
code »
valueOf() number
No description.
Returns: number  Value of wrapped date.
code »

Instance Properties

constructor :
No description.
Code »
constructor :
No description.
Code »
Defined in goog.date.Date
date :
No description.
Code »
firstDayOfWeek_ :
First day of week. 0 = Mon, 6 = Sun.
Code »
firstWeekCutOffDay_ :
The cut off weekday used for week number calculations. 0 = Mon, 6 = Sun.
Code »

Static Methods

goog.date.UtcDateTime.fromIsoString(formatted) goog.date.UtcDateTime
Creates a DateTime from a UTC datetime string expressed in ISO 8601 format.
Arguments:
formatted : string
A date or datetime expressed in ISO 8601 format.
Returns: goog.date.UtcDateTime  Parsed date or null if parse fails.
code »
goog.date.UtcDateTime.fromTimestamp(timestamp) !goog.date.UtcDateTime
No description.
Arguments:
timestamp : number
Number of milliseconds since Epoch.
Returns: !goog.date.UtcDateTime  No description.
code »

Static Properties

goog.date.UtcDateTime.superClass_ :
No description.
Code »

Package date

Package Reference