Method Date.setISOWeek
Set the ISO week number of the year of a date
-
Syntax
undefined Date.setISOWeek(Number w , [ Boolean utc ])
When setting the week number of a date the date becomes the monday of that week. Ifutcis true then universal time is used; otherwise the local time is used. -
Parameters
Number w- The week number
Boolean utc(Optional)- Set to true to use UTC.
-
Return value
No explicit return value. Default value of
undefinedis returned. -
Examples
- To set the week to 34 of the year 2007
// Create date var d = new Date(2008,0,1) // Set the week d.setISOWeek(34); // Output is ' Monday 20th of August 2007'
- Related Date.getISOWeek
- Resources See ISO 8601 at Wikipedia.org if you are curious about how week numbers are defined.
-
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.
This function has dependencies and will not work stand-alone. Use the download button above instead of copy/paste.
