Home  >  Article  >  Web Front-end  >  仅2行代码的javascript按指定格式显示日期时间效果_时间日期

仅2行代码的javascript按指定格式显示日期时间效果_时间日期

WBOY
WBOYOriginal
2016-05-16 18:01:46996browse

在蓝色理想学习了N年,今天第一次发点自己的原创,因为我曾为解决该问题花了不少时间,主要是网络上找到的代码要么非常烦琐,要么不能通用或格式只能固定几个,所以我专门对这个问题进行了研究,最终优化到只有2行代码,非常精简。主要是用到了JSON、正则和eval 函数,如果有什么问题欢迎大家指正。
感谢zhanyuzai 的优化,经测试2行代码没有发现问题,现在已更新过来


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn