date转为json的时间解析

来源:互联网 发布:在淘宝买药怎样付款 编辑:程序博客网 时间:2024/05/21 17:09

时间date类型转为json

我输入的时间为:1900-01-01 00:00:00.0

json串为
{"nanos":0,"time":-2209017600000,"minutes":0,"seconds":0,"hours":0,"month":0,"timezoneOffset":-480,"year":0,"day":1,"date":1}

解析:

year          (年)-->0

month      (月)-->0

date          (日)-->1

hours        (小时)-->0  

minutes    (分钟)-->0

seconds   (秒钟)-->0

预测时间从1900-01-00 00:00:00

function converDate(dateTime){
    var year = 1900+ dateTime.year;
    var month = 1 + dateTime.month;
    return year +'-'+month +'-'+dateTime.date+' '+dateTime.hours+':'+dateTime.minutes+':'+dateTime.seconds;
};
0 0
原创粉丝点击