JavaScript获取iOS浏览器当前时间戳

//获取系统当前时间戳
var myDate = new Date();
var year = myDate.getFullYear();//年
var month = myDate.getMonth()+1;//月
if(month<=9){month='0'+month;}
var date = myDate.getDate();//日
if(date<=9){date='0'+date;}
var hour = myDate.getHours();//时
if(hour<=9){hour='0'+hour;}
var minute = myDate.getMinutes();//分
if(minute<=9){minute='0'+minute;}
var second = myDate.getSeconds();//秒
if(second<=9){second='0'+second;}
var millisecond = myDate.getMilliseconds();//毫秒
if(millisecond<=9){millisecond='00'+millisecond;}else if(millisecond<=99){millisecond='0'+millisecond;}
var nowtime = year+'-'+month+'-'+date+' '+hour+':'+minute+':'+second+'.'+millisecond;
nowtime = nowtime.substring(0,19);    
nowtime = nowtime.replace(/-/g,'/'); 
nowtime = new Date(nowtime).getTime();
alert(nowtime);
版权声明:若无特殊注明,本文皆为( VISAce )收集整理,版权归原作者所有。—— 李佳培.中国

暧昧贴

发表评论

      avatar
      • 微笑 大笑 拽 大哭 奸笑 流汗 喷血 生气 囧 不爽 晕 示爱 害羞 吃惊 惊叹 爱你 吓死了 呵呵
      0
      假装提交肿...



      既然没有评论,那就赶紧抢沙发吧!