Method Date.getISOWeek
Return the ISO week number of the year of a date.
-
Syntax
Number Date.getISOWeek([ Boolean utc ])
The ISO 8601 standard counts the weeks of the year consecutive starting from 1. Week 1 is defined as 'the week which contains January the forth'. Ifutcis set to true the universal time is used; otherwise the local time is used. -
Parameters
Boolean utc(Optional)- Set to true to use UTC.
- Return value The ISO week number of the year.
-
Examples
- To get the week number of the 24th December 2008
// Create the date var d = new Date(2008,11,24); // Output is 52 var w = d.getISOWeek();
- Related Date.format Date.setISOWeek
-
Resources
See ISO 8601 at Wikipedia.org if you are curious about how week numbers are defined.
The algorithm for calculating week numbers is taken from the calendar FAQ of Claus Tøndering. If you ever wanted to know anything about calendars this is the place to start. -
Download
Source
Unless otherwise noted all code in the JSLab Standard Library is licensed as GPLv3. See http://www.gnu.org/licenses/gpl.html for the entire license.
