Showing posts with label
getWeekFromDate
.
Show all posts
Showing posts with label
getWeekFromDate
.
Show all posts
Monday, April 3, 2023
Get week number of month from Date
People struggle a lot when it needs to get a week from a date, here below is a simple example to get the week number of the month from a Date.
function getWeekOfMonth(date) { let adjustedDate = date.getDate()+date.getDay(); let prefixes = ['1', '2', '3', '4', '5','6']; return (parseInt(prefixes[0 | adjustedDate / 7])+1); }
Older Posts
Home
Subscribe to:
Posts (Atom)