Skip to content

Latest commit

 

History

History
19 lines (11 loc) · 450 Bytes

日期相关.md

File metadata and controls

19 lines (11 loc) · 450 Bytes

1

new Date().toLocaleDateString() // 2020/3/31

new Date().toLocaleDateString().replace(/\//g,'-') // 2020-3-31

2

// 为什么 new Date().getMonth()返回 0-11

// 因为数组是从 0 开始的,便于对应每一个月份名字。而日期一般是没有对应的名字的。
["January", "February", "March", "April", "May", "June", "July","August", "September", "October", "November", "December"]