tolocaledatestring 第6页
- 前端JavaScript获取当前时间的方法
-
vartime=newDate();time.getYear();//获取当前年份time.getFullYear();//获取完整的年份(4位,2021-???)time.getMonth();//获取当前月份(0-11,0代表1月)...
- 警惕Javascript的toLocaleDateString在英文浏览器下的坑
-
toLocaleDateString的作用是根据本地时间把Date对象的日期部分转换为字符串,首先看下下面这段代码:vardata=newDate();varstr=data.toLocaleDateString();console.log(str);...