Home

# Class goog.date.DateTime

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) ⇒ boolean` Tests whether given datetime is exactly equal to this DateTime.
| `getHours() ⇒ number` Returns the hours part of the datetime.
| `getMilliseconds() ⇒ number` Returns the milliseconds part of the datetime.
| `getMinutes() ⇒ number` Returns the minutes part of the datetime.
| `getSeconds() ⇒ number` Returns the seconds part of the datetime.
| `getUTCDay() ⇒ ?goog.date.weekDay` Returns the day of week according to universal time, US style.
| `getUTCHours() ⇒ number` Returns the hours part of the datetime according to universal time.
| `getUTCMilliseconds() ⇒ number` Returns the milliseconds part of the datetime according to universal time.
| `getUTCMinutes() ⇒ number` Returns the minutes part of the datetime according to universal time.
| `getUTCSeconds() ⇒ number` Returns 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) ⇒ string` Returns ISO 8601 string representation of date/time.
| `toIsoTimeString(boolean= 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'.
| `toString() ⇒ string` Overloaded toString method for object.
| `toUTCIsoString(boolean= opt_verbose, boolean= opt_tz) ⇒ string` Returns ISO 8601 string representation of date/time according to universal time.
| `toUsTimeString(boolean= opt_padHours, boolean= opt_showAmPm, boolean= opt_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.
| `toXmlDateTime(boolean= opt_timezone) ⇒ string` Returns XML Schema 2 string representation of date/time. The return value is also ISO 8601 compliant.

Static Method Summary
| `fromRfc822String(string formatted) ⇒ ?goog.date.DateTime` Creates a DateTime from a datetime string expressed in RFC 822 format.