javascript - Is there a function in jq that converts timestamp to date? It is not the kind written by myself, it is jq itself.
迷茫2017-05-19 10:37:39
0
5
474
Asking a very simple question, is there a function in jq that converts timestamps into dates? It is not the kind I wrote myself, it is encapsulated by jq itself.
If not, I will convert it directly in php, but I still want to know if there is
貌似没有的。都是自己处理的
js本身就有 new Date(timestamp),这样new了一个js的日期对象,这个对象有getDate,getMonth,getFullYear等方法可以获取到年月日,详细看文档:https://developer.mozilla.org...
注意js的时间戳是以毫秒为单位
特意把jquery 源码搜索了一边,没有直接得到日期格式的 函数 ,需要自己手动组合 ,jq 新增了个 $.now() 得到的也是时间戳 。
jQuery-ui有一个dataPicker插件,获取时间,还能配置时间输出格式