Skip to content

Instantly share code, notes, and snippets.



Created Apr 2, 2019
What would you like to do?
Add days to a date in javascript. Can use in conjunction with `setHours` to get the exact time of a specific day
function addDaysToDate(date,numberOfDays){
return new Date(
date.getTime() +
function daysToMilliseconds(days){
return days * 86400000
console.log(addDaysToDate(new Date(),6).toDateString())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.