时间转化对ios安卓兼容性

var getTime=function(time){
var myDate = new Date(time);
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
if(isiOS){
var t = new Date(time.replace(/-/g,'/')).getTime();
}else{
var t = myDate.getTime();
}
return t;
}

猜你喜欢

转载自www.cnblogs.com/lixuehong/p/10472363.html