goog.date
Namespacegoog.date.Date
ClassClass representing a date. Defaults to current date if none is specified. Implements most methods of the native js Date object (except the time related ones, {@see goog.date.DateTime}) and can be used interchangeably with it just as if goog.date.Date was a synonym of Date. To make this more transparent, Closure APIs should accept goog.date.DateLike instead of the real Date object. To allow goog.date.Date objects to be passed as arguments to methods expecting Date objects this class is marked as extending the built in Date object even though that's not strictly true. … more
.DateLike
goog.date.DateRange
ClassConstructs a date range. … more
goog.date.DateTime
ClassClass 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. … more
goog.date.Interval
ClassClass representing a date/time interval. Used for date calculations.
new goog.date.Interval(0, 1) // One month new goog.date.Interval(0, 0, 3, 1) // Three days and one hour new goog.date.Interval(goog.date.Interval.DAYS, 1) // One day… more
goog.date.UtcDateTime
ClassClass 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. … more
.formatMonthAndYear(monthName, yearNum)
Formats a month/year string. Example: "January 2008"
monthName
{string
}
yearNum
{number
}
string
}
.fromIsoString(formatted)
Creates a DateTime from a datetime string expressed in ISO 8601 format.
formatted
{string
}
goog.date.DateTime
}
.getNumberOfDaysInMonth(year, month)
Returns the number of days for a given month.
year
{number
}
month
{number
}
number
}
.getWeekNumber(year, month, date, opt_weekDay, opt_firstDayOfWeek)
Static function for week number calculation. ISO 8601 implementation.
year
{number
}
month
{number
}
date
{number
}
opt_weekDay
{number
=}
opt_firstDayOfWeek
{number
=}
number
}
.isLeapYear(year)
Returns whether the given year is a leap year.
year
{number
}
boolean
}
.isLongIsoYear(year)
Returns whether the given year is a long ISO year. See {@link http://www.phys.uu.nl/~vgent/calendar/isocalendar_text3.htm}.
year
{number
}
boolean
}
.isSameDay(date, opt_now)
Returns true if the 2 dates are in the same day.
date
{goog.date.DateLike
}
opt_now
{goog.date.DateLike
=}
boolean
}
.isSameMonth(date, opt_now)
Returns true if the 2 dates are in the same month.
date
{goog.date.DateLike
}
opt_now
{goog.date.DateLike
=}
boolean
}
.isSameYear(date, opt_now)
Returns true if the 2 dates are in the same year.
date
{goog.date.DateLike
}
opt_now
{goog.date.DateLike
=}
boolean
}
goog.date.month
EnumConstants for months. … more
goog.date.relative
Namespace.setIso8601DateTime(dateTime, formatted)
Parses a datetime string expressed in ISO 8601 format. Overwrites the date and optionally the time part of the given object with the parsed values.
dateTime
{!goog.date.DateTime
}
formatted
{string
}
boolean
}
goog.date.weekDay
EnumConstants for weekdays. … more