setWeek
Modified on Tue, 22 Aug 2023
Description
Use this function to set the local week to the given date, saving the weekday number. The "week" parameter allows you to specify the desired week number, and you can also customize the first weekday using the "options" parameter. The function will return the resulting date with the specified week and weekday configuration.
Syntax
setWeek(date, week, options)
Returns
Return Value | Description |
---|---|
Date | Return the resulting date. |
Sample
Example | Result | Description |
---|---|---|
setWeek(2023-4-10, 16, {'first_weekday': 0}) | 2023-04-10 (set to week 16 with Monday as the first weekday) | Set the date to week 16 with Monday as the first weekday. |
To view all the Date functions, click here.
See Also
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article