我們如何將112889(mmddyy)這個未格式化的日期轉換爲像11/28/89這樣的特定格式?如何將112889(mmddyy)轉換爲11/28/89或11/28/1989
console.log(new Date('112889'))
// I got this: Sat Jan 01 112889 00:00:00 GMT+0800
我已經在谷歌搜索任何地方關於此問題,但沒有找到具體答案。
參考搜索:
- https://forums.asp.net/t/1987249.aspx?How+can+i+convert+Date+1365715800000+format+to+MM+dd+yyyy
- Convert number into date using javascript
林還想着momentjs格式,但找不到這方面有任何文檔還是我只錯過了
看看moment.js庫。 https://momentjs.com/docs/。時刻(「112889」,「MMDDYY」); –
當然! @SubirKumarSao –