PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

js操作时间

原创
2016-06-07 11:36:21 635浏览

js获取当前时间,指定时间的时间戳
function transdate(endTime){
var date=new Date();
date.setFullYear(endTime.substring(0,4));
date.setMonth(endTime.substring(5,7)-1);
date.setDate(endTime.substring(8,10));
date.setHours(endTime.substring(11,13));
date.setMinutes(endTime.substring(14,16));
date.setSeconds(endTime.substring(17,19));
return Date.parse(date)/1000;
}
alert(transdate('2015-11-30 17:45:00'));// 指定时间的时间戳

var date =new Date();
var currenttime = Date.parse(date)/1000;
alert(currenttime );// 当前时间的时间戳

AD:真正免费,域名+虚机+企业邮箱=0元

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。