0
我想知道爲什麼日期格式在一些字段之間是不同的。我的原則聲明如下:Cumulocity日期格式
@Name("measurement_occupation")
context ParkingSpotOccupation
insert into CreateMeasurement
select
e.source as source,
"ParkingSpotOccupation" as type,
min(e.time) as time,
{
"startDate", min(e.time),
"endDate", max(e.time),
"duration", dateDifferenceInSec(max(e.time), min(e.time))
} as fragments
from
SmartParkingEvent e
output
last when terminated;
,結果是使用API測量如下:
{
"time": "2016-05-30T06:00:00.000+02:00",
"id": "33200",
"self": "https://management.post-iot.lu/measurement/measurements/33200",
"source": {
"id": "26932",
"self": "https://management.post-iot.lu/inventory/managedObjects/26932"
},
"type": "ParkingSpotOccupation",
"startDate": {
"time": 1464580800000,
"minutes": 0,
"seconds": 0,
"hours": 6,
"month": 4,
"timezoneOffset": -120,
"year": 116,
"day": 1,
"date": 30
},
"duration": 600,
"endDate": {
"time": 1464581400000,
"minutes": 10,
"seconds": 0,
"hours": 6,
"month": 4,
"timezoneOffset": -120,
"year": 116,
"day": 1,
"date": 30
}
}
爲什麼吃了時間且StartDate /結束日期呈現不同?更奇怪的是,當顯示我的事件processig規則的輸出是格式如下:
{ "time": { "date": 30, "day": 1, "hours": 6, "minutes": 0, "month": 4, "seconds": 0, "time": 1464580800000, "timezoneOffset": -120, "year": 116 }, "source": "26932", "fragments": [ "startDate", { "date": 30, "day": 1, "hours": 6, "minutes": 0, "month": 4, "seconds": 0, "time": 1464580800000, "timezoneOffset": -120, "year": 116 }, "endDate", { "date": 30, "day": 1, "hours": 6, "minutes": 10, "month": 4, "seconds": 0, "time": 1464581400000, "timezoneOffset": -120, "year": 116 }, "duration", 600 ], "type": "ParkingSpotOccupation" }
所以每次約會看起來是一樣的,但不是當我使用API來訪問測量。我希望所有日期都以這種格式存儲:「2016-05-30T06:00:00.000 + 02:00」。我也嘗試使用cast(min(e.time),Date),但是我得到了一個錯誤(類名爲'Date'的cast函數列出的類不能被加載)。我嘗試了toDate()函數,但它沒有改變任何東西。