JavaScript 之处理日期类型
发布日期:2021-10-13 12:43:53 浏览次数:2 分类:技术文章

本文共 771 字,大约阅读时间需要 2 分钟。

分享好文:

【这篇文章里面有比较全的日期处理函数】

let date = new Date()console.log(date) // Wed Mar 25 2020 19:29:07 GMT+0800 (中国标准时间)console.log(date.toString()) // Wed Mar 25 2020 19:42:56 GMT+0800 (中国标准时间)console.log(date.toTimeString()) // 19:39:22 GMT+0800 (中国标准时间)console.log(date.toGMTString()) // Wed, 25 Mar 2020 11:39:22 GMTconsole.log(date.toUTCString()) // Wed, 25 Mar 2020 11:42:56 GMTconsole.log(date.toDateString()) // Wed Mar 25 2020console.log(date.toLocaleDateString()) // 2020/3/25console.log(date.toLocaleString()) // 2020/3/25 下午7:29:07console.log(date.toLocaleTimeString()) // 下午7:42:56console.log(date.toISOString()) // 2020-03-25T11:39:22.076Zconsole.log(date.toJSON()) // 2020-03-25T11:39:22.076Zconsole.log(date.toSource()) // 报错console.log(date.toLocaleFormat()) // 报错

转载地址:https://blog.csdn.net/qq_41956139/article/details/105102817 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Vue Element UI 之 date-picker 禁用时间和报错:TypeError: Cannot read property 'getHours' of undefined
下一篇:JS 之数组和对象的比较总结(随时补充)

发表评论

最新留言

路过,博主的博客真漂亮。。
[***.116.15.85]2024年04月18日 05时51分10秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章