-- --
正在获取
我的小世界 新手码农的小世界
一个时间转换英文JS代码
发表于 2017-11-23 | | APP开发


function getCurrentDate(data) {
     var date = new Date(data);
     console.log(date);
     var monthArray=new Array
     ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug",
     "Sep","Oct","Nov","Dec");
     var weekArray = new Array("Sun","Mon","Tue",
          "Wed","Thu","Fri","Sat");
     month=date.getMonth();
     day=date.getDate();
     if(day.toString().length == 1){
         day="0"+day.toString();
     }
     var time = weekArray[date.getDay()]
    +" "
    +day
    +" "
    +monthArray[month]+". "
    +date.getFullYear() ;
     return time;   
}


 另外苹果开发H5的时候时间格式务必要转换为2017/08/23格式,否则不能输出!!!切记


发表评论:


GO