위 챗 애플 릿 가 져 오기 시스템 시간, 시간 스탬프, 시간 스탬프 가감


http://blog.csdn.net/ufo00001/article/details/72834437
//       
    var timestamp = Date.parse(new Date());
    timestamp = timestamp / 1000;
    console.log("      :" + timestamp);

//      
    var n = timestamp * 1000;
    var date = new Date(n);
    // 
    var Y = date.getFullYear();
    // 
    var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
    // 
    var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
    // 
    var h = date.getHours();
    // 
    var m = date.getMinutes();
    // 
    var s = date.getSeconds();
  
    console.log("    :" +Y+M+D+h+":"+m+":"+s);
    
//          
    console.log(date.toDateString());

    console.log(date.toGMTString());

    console.log(date.toISOString());
  
    console.log(date.toJSON());
    
    console.log(date.toLocaleDateString());

    console.log(date.toLocaleString());
  
    console.log(date.toLocaleTimeString());
   
    console.log(date.toString());
   
    console.log(date.toTimeString());
   
    console.log(date.toUTCString());

 
//  、            ,          
    //       :
    var tomorrow_timetamp = timestamp + 24 * 60 * 60;
    //      :
    var n_to = tomorrow_timetamp * 1000;
    var tomorrow_date = new Date(n_to);
    //       
    var Y_tomorrow = tomorrow_date.getFullYear();
    //       
    var M_tomorrow = (tomorrow_date.getMonth() + 1 < 10 ? '0' + (tomorrow_date.getMonth() + 1) : tomorrow_date.getMonth() + 1);
    //       
    var D_tomorrow = tomorrow_date.getDate() < 10 ? '0' + tomorrow_date.getDate() : tomorrow_date.getDate();
    //       
    var h_tomorrow = tomorrow_date.getHours();
    //       
    var m_tomorrow = tomorrow_date.getMinutes();
    //       
    var s_tomorrow = tomorrow_date.getSeconds();

 
 
 
 
 
 
 

좋은 웹페이지 즐겨찾기