/**
* 时间戳转日期
* @param timestamp
* @returns {*}
*/
function toTime(timestamp) {
//时间戳为10位需*1000,时间戳为13位的话不需乘1000
var date = new Date(timestamp * 1000);
Y = date.getFullYear() + '-';
M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1)+'-';
D = date.getDate() + ' ';
h = date.getHours() + ':';
m = (date.getMinutes() < 10 ? '0'+(date.getMinutes()) : date.getMinutes())+':';
s = (date.getSeconds() < 10 ? '0'+(date.getSeconds()) : date.getSeconds());
return Y+M+D+h+m+s;
}
jquery时间加减 jquery时间戳转换日期格式
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
【Jquery插件集合】轮播、时间处理插件
【Jquery插件集合】轮播、时间处理插件
jquery css JavaScript -
day.js 时间戳
day.js 的时间戳 希望大家可以补充
时间段 时间戳 时间处理 -
jquery 时间戳与日期转换
(function($) { $.extend({ myTime: { /** * 当前时间戳 * @return unix时间戳(秒) */ ...
unix 时间戳 jquery 日期格式 其他