Incrementing a JavaScript Date Object by One Day
You have a Date object and wish to increment it by one day using JavaScript's Date object. Here's an improved solution for your code:
Replace your current code with the following to add one day to the Date object:
var date = new Date(); // add a day date.setDate(date.getDate() 1); 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() });
This code:
Using this method, you can increment the date object by any number of days. For example, to increment by two days, you would use date.setDate(date.getDate() 2).
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3