PHP群:95885625 Hbuilder+MUI群:81989597 站长QQ:634381967
    您现在的位置: 首页 > 开发编程 > JavaScript教程 > 正文

    js时间戳转换成年月日,js日期转换成时间戳

    作者:admin来源:网络浏览:时间:2020-09-30 00:07:50我要评论
    导读:js时间戳转换成年月日,js日期转换成时间戳,分享给大家,希望对大家有所帮助。
    js时间戳转换成年月日,js日期转换成时间戳

    1. //年月日时间转换成时间戳 
    2. var date="2015-12-3"
    3. date = date.replace(/-/g,'/');  
    4. var time = new Date(date).getTime(); 
    5. time =parseInt(time/1000+21*24*3600); 
    6.  
    7. //时间戳转换成年月日www.bcty365.com 
    8. var dzsj=get_Date(time); 
    9.  
    10. function get_Date(tm){  
    11. var d = new Date(tm * 1000);    //根据时间戳生成的时间对象 
    12. var date = (d.getFullYear()) + "-" +  
    13.            (d.getMonth() + 1) + "-" + 
    14.            (d.getDate()); 
    15.          return date; 

     

    转载请注明(B5教程网)原文链接:https://b5.mxunkeji.com/content-69-3074-1.html
    相关热词搜索: