KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've created this script to calculate the date for 10 days in advance in the format of dd/mm/yyyy: var MyDate = new Date(); var MyDateString = new Date(); MyDate.setDate(MyDate.getDate()+10); MyDateString = MyDate.getDate() + '/' + (MyDate.getMonth()+1) + '/' + MyDate.getFullYear(); I need to have the date appear with leading zeroes on the day and month component by way of adding these rules to the script. I can't seem to get it to work. if (MyDate.getMonth < 10)getMonth = '0' + getMonth; and if (MyDate.getDate <10)get.Date = '0' + getDate; If someone could show me where to insert these into the script I would be really appreciative.
Tags (comma-separated)
Save Edits
Cancel