码迷,mamicode.com
首页 > 编程语言 > 详细

【JavaScript】时间戳转日期格式

时间:2017-06-27 12:58:32      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:gets   val   var   .sh   code   function   span   .ajax   ges   

时间戳: 1480570979000

 

    $.ajax({
            
                url : "getOrderMsg?shiplabel="+ shiplabel,
                type : "get",    
                success : function(data) {//ajax返回的数据    
                    var now = new Date(data.createtime); //data.createtime=1480570979000
var years=now.getYear(); 
var year
= (years+"").substring(1);
var month
=now.getMonth()+1;
var date
=now.getDate();
var hour
=now.getHours();
var minute
=now.getMinutes();
var second
=now.getSeconds();
var date
= "20"+year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second;
var html
="订单号:"+data.ordernumber+" 订单创建时间:"+date+" 收件人:"+data.shiptoname+" 电话:"+data.shiptophone+" 地址:"+data.addr;
$(
"#p1").html(html).show(); } });

 

技术分享

【JavaScript】时间戳转日期格式

标签:gets   val   var   .sh   code   function   span   .ajax   ges   

原文地址:http://www.cnblogs.com/dflmg/p/7084499.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!