📜  Javascript 迄今为止添加前导零 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:11.432000             🧑  作者: Mango

代码示例4
var MyDate = new Date();
var MyDateString;

MyDate.setDate(MyDate.getDate() + 20);

MyDateString = ('0' + MyDate.getDate()).slice(-2) + '/'
             + ('0' + (MyDate.getMonth()+1)).slice(-2) + '/'
             + MyDate.getFullYear();