你能解释一下这种日期格式吗?这是我的表id = 8数据 我不明白这种格式
id=8|startTime=1900-02-20 00:00:00|endTime=1900-02-20 00:00:00
|AverageMeetTime=60|idDoctor=3|cancelled=0|permanentlyCancelled=0
JSON FORMAT SHOW THIS::
{
"averageMeetTime": 60,
"cancelled": false,
"endTime":
{
"date": 20,
"day": 5,
"hours": 0,
"minutes": 0,
"month": 1,
"seconds": 0,
"time": 1424370600000,
"timezoneOffset": -330,
"year": 115
},
"id": 8,
"idDoctor": 3,
"permanentlyCancelled": false,
"startTime":
{
"date": 20,
"day": 5,
"hours": 0,
"minutes": 0,
"month": 1,
"seconds": 0,
"time": 1424370600000,
"timezoneOffset": -330,
"year": 115
}
}
你能解释这个日期格式.......
+------------+---------------------+---------------------+-----------------+-----------------+------------------------+-------------+
| idTimeSlot | startTime | endTime | averageMeetTime | Doctor_idDoctor | isPermanentlyCancelled | isCancelled |
+------------+---------------------+---------------------+-----------------+-----------------+------------------------+-------------+
| 1 | 2016-02-20 01:00:00 | 2016-02-20 02:00:00 | 20 | 3 | 0 | 0 |
| 2 | 2016-02-21 01:00:00 | 2016-02-21 02:00:00 | 60 | 3 | 0 | 0 |
| 3 | 2016-02-22 01:00:00 | 2016-02-22 02:00:00 | 60 | 3 | 0 | 0 |
| 4 | 2016-02-23 01:00:00 | 2016-02-23 02:00:00 | 60 | 3 | 0 | 0 |
| 5 | 2016-02-24 01:00:00 | 2016-02-24 02:00:00 | 60 | 3 | 0 | 0 |
| 6 | 2016-02-25 01:00:00 | 2016-02-25 02:00:00 | 60 | 3 | 0 | 0 |
| 7 | 2016-02-26 01:00:00 | 2016-02-26 02:00:00 | 60 | 3 | 0 | 0 |
| 8 | 1900-02-20 00:00:00 | 1900-02-20 00:00:00 | 60 | 3 | 0 | 0 |
+------------+---------------------+---------------------+-----------------+-----------------+------------------------+-------------+
答案 0 :(得分:0)
您需要将JSON对象存储到变量以使用其属性来创建Date
对象,因为此JSON对象不是Date
类型。您可以使用Python 3 function annotations中的任何构造函数。
我只想要这种格式.....(yyyy-MM-dd)
您可以使用time
属性。
var json = {"endTime": {
"date": 20,
"day": 5,
"hours": 0,
"minutes": 0,
"month": 1,
"seconds": 0,
"time": 1424370600000,
"timezoneOffset": -330,
"year": 115
}
};
document.getElementById("demo").innerHTML = new Date(json.endTime.time).toLocaleFormat("%Y-%m-%d");