Loading... ## 获取当前时间 ```javascript function timeDate(){ let timestamp = Date.parse(new Date()); let date = new Date(timestamp); //获取年 let Y = date.getFullYear(); //获取月 let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1); //获取当日 let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate(); return (Y + '年' + M + '月' + D + '日'); } ``` <hr class="content-copyright" style="margin-top:50px" /><blockquote class="content-copyright" style="font-style:normal"><p class="content-copyright">版权属于:本当迷博客</p><p class="content-copyright">本文链接:<a class="content-copyright" href="https://www.bdmcom.cn/532.html">https://www.bdmcom.cn/532.html</a></p><p class="content-copyright"><div style="color:red">转载时须注明出处及本声明<div/></p></blockquote> 最后修改:2022 年 03 月 31 日 09 : 06 PM © 允许规范转载 赞赏 都是自己人,随意打赏点!别客气! 赞赏作者 支付宝微信