Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript date set day of week

// given: date, day
let time = date.getTime()
const daysToAdd = day - date.getDay()
time += daysToAdd * 24 * 60 * 60 * 1000
return new Date(time)
 
PREVIOUS NEXT
Tagged: #javascript #date #set #day #week
ADD COMMENT
Topic
Name
5+8 =