franticfrantic franticfrantic - 1 year ago 83
Javascript Question

Add +1 to current date

I have

var ds = stringFormat("{day} {date} {month} {year}", {
day: companyname.i18n.translate("day", language)[date.getUTCDay()],
date: date.getUTCDate(),
month: companyname.i18n.translate("month", language)[date.getUTCMonth()],
year: date.getUTCFullYear()

how do I add +1 into it?

ive added +1 unto getUTCDay() and getUTCDate() but 'Sunday' doesnt display it.

Answer Source

To add one day to a date object:

var date = new Date();

// add a day
date.setDate(date.getDate() + 1);