Class representing a date and time. Defaults to current date and time if none is specified. Implements most methods of the native js Date object and can be used interchangeably with it just as if goog.date.DateTime was a subclass of Date.
extends goog.date.Date| Instance Method Summary | |
add(?goog.date.Interval interval)Performs date calculation by adding the supplied interval to the date. | |
clone() ⇒ !goog.date.DateTime | |
equals(?goog.date.DateTime other) ⇒ booleanTests whether given datetime is exactly equal to this DateTime. | |
getHours() ⇒ numberReturns the hours part of the datetime. | |
getMilliseconds() ⇒ numberReturns the milliseconds part of the datetime. | |
getMinutes() ⇒ numberReturns the minutes part of the datetime. | |
getSeconds() ⇒ numberReturns the seconds part of the datetime. | |
getUTCDay() ⇒ ?goog.date.weekDayReturns the day of week according to universal time, US style. | |
getUTCHours() ⇒ numberReturns the hours part of the datetime according to universal time. | |
getUTCMilliseconds() ⇒ numberReturns the milliseconds part of the datetime according to universal time. | |
getUTCMinutes() ⇒ numberReturns the minutes part of the datetime according to universal time. | |
getUTCSeconds() ⇒ numberReturns the seconds part of the datetime according to universal time. | |
setHours(number hours)Sets the hours part of the datetime. | |
setMilliseconds(number ms)Sets the seconds part of the datetime. | |
setMinutes(number minutes)Sets the minutes part of the datetime. | |
setSeconds(number seconds)Sets the seconds part of the datetime. | |
setUTCHours(number hours)Sets the hours part of the datetime according to universal time. | |
setUTCMilliseconds(number ms)Sets the seconds part of the datetime according to universal time. | |
setUTCMinutes(number minutes)Sets the minutes part of the datetime according to universal time. | |
setUTCSeconds(number seconds)Sets the seconds part of the datetime according to universal time. | |
toIsoString(boolean= opt_verbose, boolean= opt_tz) ⇒ stringReturns ISO 8601 string representation of date/time. | |
toIsoTimeString(boolean= opt_showSeconds) ⇒ stringGenerates time label for the datetime in standard ISO 24-hour time format. E.g., '06:00:00' or '23:30:15'. | |
toString() ⇒ stringOverloaded toString method for object. | |
toUTCIsoString(boolean= opt_verbose, boolean= opt_tz) ⇒ stringReturns ISO 8601 string representation of date/time according to universal time. | |
toUsTimeString(boolean= opt_padHours, boolean= opt_showAmPm, boolean= opt_omitZeroMinutes) ⇒ stringGenerates 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. | |
toXmlDateTime(boolean= opt_timezone) ⇒ stringReturns XML Schema 2 string representation of date/time. The return value is also ISO 8601 compliant. | |
| Static Method Summary | |
fromRfc822String(string formatted) ⇒ ?goog.date.DateTimeCreates a DateTime from a datetime string expressed in RFC 822 format. | |