Home

# Library goog.date

Function Summary
| `formatMonthAndYear(string monthName, number yearNum) ⇒ string` Formats a month/year string. Example: "January 2008"
| `fromIsoString(string formatted) ⇒ ?goog.date.DateTime` Creates a DateTime from a datetime string expressed in ISO 8601 format.
| `getNumberOfDaysInMonth(number year, number month) ⇒ number` Returns the number of days for a given month.
| `getWeekNumber(number year, number month, number date, number= opt_weekDay, number= opt_firstDayOfWeek) ⇒ number` Static function for week number calculation. ISO 8601 implementation.
| `isLeapYear(number year) ⇒ boolean` Returns whether the given year is a leap year.
| `isLongIsoYear(number year) ⇒ boolean` Returns whether the given year is a long ISO year. See {@link http://www.phys.uu.nl/~vgent/calendar/isocalendar_text3.htm}.
| `isSameDay(?goog.date.DateLike date, ?goog.date.DateLike= opt_now) ⇒ boolean` Returns true if the 2 dates are in the same day.
| `isSameMonth(?goog.date.DateLike date, ?goog.date.DateLike= opt_now) ⇒ boolean` Returns true if the 2 dates are in the same month.
| `isSameYear(?goog.date.DateLike date, ?goog.date.DateLike= opt_now) ⇒ boolean` Returns true if the 2 dates are in the same year.

`setDateFromIso8601Week_(?goog.date.DateTime d, number week, number dayOfWeek)`

Sets date fields based on an ISO 8601 week string. See {@link http://en.wikipedia.org/wiki/ISO_week_date}, "Relation with the Gregorian Calendar". The first week of a new ISO year is the week with the majority of its days in the new Gregorian year. I.e., ISO Week 1's Thursday is in that year. ISO weeks always start on Monday. So ISO Week 1 can contain a few days from the previous Gregorian year. And ISO weeks always end on Sunday, so the last ISO week (Week 52 or 53) can have a few days from the following Gregorian year. Example: '1997-W01' lasts from 1996-12-30 to 1997-01-05. January 1, 1997 is a Wednesday. So W01's Monday is Dec.30, 1996, and Sunday is January 5, 1997.

| `setIso8601DateOnly_(!goog.date.DateTime d, string formatted) ⇒ boolean` Sets date fields based on an ISO 8601 format string.
| `setIso8601DateTime(!goog.date.DateTime dateTime, string formatted) ⇒ boolean` 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.
| `setIso8601TimeOnly_(!goog.date.DateTime d, string formatted) ⇒ boolean` Sets time fields based on an ISO 8601 format string. Note: only time fields, not date fields.