goog.date.DateTime
Classgoog.date.DateTime
> goog.date.Date
goog.date.DateTime(opt_year, opt_month, opt_date, opt_hours, opt_minutes, opt_seconds,
opt_milliseconds)
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.
opt_year
{number
|Object
=}
opt_month
{number
=}
opt_date
{number
=}
opt_hours
{number
=}
opt_minutes
{number
=}
opt_seconds
{number
=}
opt_milliseconds
{number
=}
.add(interval)
Performs date calculation by adding the supplied interval to the date.
interval
{goog.date.Interval
}
.clone()
goog.date.DateTime
}
.equals(other)
Tests whether given datetime is exactly equal to this DateTime.
other
{goog.date.Date
}
boolean
}
.fromRfc822String(formatted)
Creates a DateTime from a datetime string expressed in RFC 822 format.
formatted
{string
}
goog.date.DateTime
}
.getDate()
Inherited from goog.date.Date
.
number
}
.getDay()
Inherited from goog.date.Date
.
goog.date.weekDay
}
.getDayOfYear()
Inherited from goog.date.Date
.
number
}
.getFirstDayOfWeek()
Inherited from goog.date.Date
.
number
}
.getFirstWeekCutOffDay()
Inherited from goog.date.Date
.
number
}
.getFullYear()
Inherited from goog.date.Date
.
number
}
.getHours()
Returns the hours part of the datetime.
number
}
.getIsoWeekday()
Inherited from goog.date.Date
.
number
}
.getMilliseconds()
Returns the milliseconds part of the datetime.
number
}
.getMinutes()
Returns the minutes part of the datetime.
number
}
.getMonth()
Inherited from goog.date.Date
.
goog.date.month
}
.getNumberOfDaysInMonth()
Inherited from goog.date.Date
.
number
}
.getSeconds()
Returns the seconds part of the datetime.
number
}
.getTime()
Inherited from goog.date.Date
.
Returns the number of milliseconds since 1 January 1970 00:00:00.
number
}
.getTimezoneOffset()
Inherited from goog.date.Date
.
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.
number
}
.getTimezoneOffsetString()
Inherited from goog.date.Date
.
Returns timezone offset as a string. Returns offset in [+-]HH:mm format or Z for UTC.
string
}
.getUTCDate()
Inherited from goog.date.Date
.
number
}
.getUTCDay()
Returns the day of week according to universal time, US style.
goog.date.weekDay
}
.getUTCFullYear()
Inherited from goog.date.Date
.
number
}
.getUTCHours()
Returns the hours part of the datetime according to universal time.
number
}
.getUTCIsoWeekday()
Inherited from goog.date.Date
.
number
}
.getUTCMilliseconds()
Returns the milliseconds part of the datetime according to universal time.
number
}
.getUTCMinutes()
Returns the minutes part of the datetime according to universal time.
number
}
.getUTCMonth()
Inherited from goog.date.Date
.
goog.date.month
}
.getUTCSeconds()
Returns the seconds part of the datetime according to universal time.
number
}
.getUTCWeekday()
Inherited from goog.date.Date
.
number
}
.getWeekNumber()
Inherited from goog.date.Date
.
number
}
.getWeekday()
Inherited from goog.date.Date
.
number
}
.getYear()
Inherited from goog.date.Date
.
Alias for getFullYear.
number
}
.set(date)
Inherited from goog.date.Date
.
Sets the date.
date
{goog.date.Date
}
.setDate(date)
Inherited from goog.date.Date
.
Sets the day part of the date.
date
{number
}
.setFirstDayOfWeek(day)
Inherited from goog.date.Date
.
Sets the first day of week.
day
{number
}
.setFirstWeekCutOffDay(day)
Inherited from goog.date.Date
.
Sets cut off weekday used for week number calculations. 0 = Mon, 6 = Sun.
day
{number
}
.setFullYear(year)
Inherited from goog.date.Date
.
Sets the year part of the date.
year
{number
}
.setHours(hours)
Sets the hours part of the datetime.
hours
{number
}
.setMilliseconds(ms)
Sets the seconds part of the datetime.
ms
{number
}
.setMinutes(minutes)
Sets the minutes part of the datetime.
minutes
{number
}
.setMonth(month)
Inherited from goog.date.Date
.
Sets the month part of the date. TODO(nnaze): Update type to goog.date.month.
month
{number
}
.setSeconds(seconds)
Sets the seconds part of the datetime.
seconds
{number
}
.setTime(ms)
Inherited from goog.date.Date
.
Sets the value of the date object as expressed in the number of milliseconds since 1 January 1970 00:00:00.
ms
{number
}
.setUTCDate(date)
Inherited from goog.date.Date
.
Sets the day part of the date according to universal time.
date
{number
}
.setUTCFullYear(year)
Inherited from goog.date.Date
.
Sets the year part of the date according to universal time.
year
{number
}
.setUTCHours(hours)
Sets the hours part of the datetime according to universal time.
hours
{number
}
.setUTCMilliseconds(ms)
Sets the seconds part of the datetime according to universal time.
ms
{number
}
.setUTCMinutes(minutes)
Sets the minutes part of the datetime according to universal time.
minutes
{number
}
.setUTCMonth(month)
Inherited from goog.date.Date
.
Sets the month part of the date according to universal time.
month
{number
}
.setUTCSeconds(seconds)
Sets the seconds part of the datetime according to universal time.
seconds
{number
}
.setYear(year)
Inherited from goog.date.Date
.
Alias for setFullYear.
year
{number
}
.toIsoString(opt_verbose, opt_tz)
Returns ISO 8601 string representation of date/time.
opt_verbose
{boolean
=}
opt_tz
{boolean
=}
string
}
.toIsoTimeString(opt_showSeconds)
Generates time label for the datetime in standard ISO 24-hour time format. E.g., '06:00:00' or '23:30:15'.
opt_showSeconds
{boolean
=}
string
}
.toString()
Overloaded toString method for object.
string
}
.toUTCIsoString(opt_verbose, opt_tz)
Returns ISO 8601 string representation of date/time according to universal time.
opt_verbose
{boolean
=}
opt_tz
{boolean
=}
string
}
.toUsTimeString(opt_padHours, opt_showAmPm, opt_omitZeroMinutes)
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.
opt_padHours
{boolean
=}
opt_showAmPm
{boolean
=}
opt_omitZeroMinutes
{boolean
=}
string
}
.toXmlDateTime(opt_timezone)
Returns XML Schema 2 string representation of date/time. The return value is also ISO 8601 compliant.
opt_timezone
{boolean
=}
string
}
.valueOf()
Inherited from goog.date.Date
.
number
}