xgqfrms / learning

learning : A collection of all kinds of resources, videos, pdf, blogs, codes... 📚 + 💻 + ❤
https://learning.xgqfrms.xyz
MIT License
16 stars 12 forks source link

moment.js 时间转化 bug #71

Open xgqfrms opened 4 years ago

xgqfrms commented 4 years ago

moment.js 时间转化 bug

格式错误

image

image

format

HHhh


new Date(1580796000000)
// Tue Feb 04 2020 14:00:00 GMT+0800 (China Standard Time)

moment(1580796000000).format('YYYY MM DD, hh:mm:ss');
// "2020 02 04, 02:00:00"

moment(1580796000000).format('YYYY-MM-DD, HH:mm:ss');
// "2020-02-04, 14:00:00"
xgqfrms commented 4 years ago

https://momentjs.com/

API

https://momentjs.com/docs/#/parsing/string-format/

https://momentjs.com/docs/#/displaying/format/

image

image

xgqfrms commented 4 years ago

https://stackoverflow.com/questions/15993913/format-date-with-moment-js

xgqfrms commented 4 years ago

https://flaviocopes.com/momentjs/

https://www.sitepoint.com/managing-dates-times-using-moment-js/

https://www.freecodecamp.org/news/the-ultimate-guide-to-javascript-date-and-moment-js/