JavaScript添加到目前為止的前導(dǎo)零我創(chuàng)建這個(gè)腳本是為了提前10天以dd/mm/yyy格式計(jì)算日期:var MyDate = new Date();var MyDateString = new Date();MyDate.setDate(MyDate.getDate()+10);MyDateString = MyDate.getDate()
+ '/' + (MyDate.getMonth()+1) + '/' + MyDate.getFullYear();通過將這些規(guī)則添加到腳本中,我需要在日期和月份組件上顯示帶前導(dǎo)零的日期。我似乎不能讓它起作用。if (MyDate.getMonth < 10)getMonth = '0' + getMonth;和if (MyDate.getDate <10)get.Date = '0' + getDate;如果有人能告訴我把這些插入到腳本中的位置,我會(huì)非常感激的。
JavaScript添加到目前為止的前導(dǎo)零
郎朗坤
2019-06-20 16:21:44