当前位置:网站首页>Specify the format time, and fill in zero before the month and days

Specify the format time, and fill in zero before the month and days

2022-07-06 16:14:00 Dream height 1.8 meters

antd DatePicker The selected time , It can be used format format :
https://blog.csdn.net/weixin_43915401/article/details/112880693
js Get time method :
https://blog.csdn.net/weixin_43915401/article/details/114014926

js The time when the specified format is generated , You can only spell it yourself , Just ... Add up , Fill the string .
padStart(2,'0')2 A string , Less than two , Fill zero in front .

let date = new Date();
YYYY-MM-DD = date.getFullYear() + '-'
        + (date.getMonth() + 1).toString().padStart(2, '0') + '-'
        + (date.getDate()).toString().padStart(2, '0');
原网站

版权声明
本文为[Dream height 1.8 meters]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060920187064.html