您好,欢迎访问一九零五行业门户网

js操作时间

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元
其它类似信息

推荐信息