You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A signed numeric value, the current number of milliseconds that have elapsed since the Unix epoch. In other words, the number of milliseconds that have elapsed since 00:00:00 Thursday, 1 January 1970.
29
31
@@ -43,27 +45,58 @@ Returns the UTC date and time ISO 8601 string value in the format `YYYY-MM-DDThh
43
45
|.fffffff|seven-digit fractional seconds|
44
46
|Z|UTC (Coordinated Universal Time) designator|
45
47
46
-
For more information on the ISO 8601 format, see [ISO_8601](https://en.wikipedia.org/wiki/ISO_8601)
48
+
For more information on the ISO 8601 format, see [ISO_8601](https://en.wikipedia.org/wiki/ISO_8601)
47
49
48
50
## Remarks
49
51
50
52
TimestampToDateTime will return `undefined` if the timestamp value specified is invalid.
51
53
52
54
## Examples
53
55
54
-
The following example converts the timestamp to a DateTime:
56
+
The following example converts the value `1,594,227,912,345` from milliseconds to a date and time of **July 8, 2020, 5:05 PM UTC**.
55
57
56
58
```sql
57
59
SELECT TimestampToDateTime(1594227912345) AS DateTime
58
60
```
59
61
60
62
```json
61
63
[
62
-
{
63
-
"DateTime": "2020-07-08T17:05:12.3450000Z"
64
-
}
64
+
{
65
+
"DateTime": "2020-07-08T17:05:12.3450000Z"
66
+
}
67
+
]
68
+
```
69
+
70
+
This next example uses the timestamp from an existing item in a container. The item's timestamp is expressed in seconds.
71
+
72
+
```json
73
+
{
74
+
"id": "8cc56bd4-5b8d-450b-a576-449836171398",
75
+
"type": "reading",
76
+
"data": "temperature",
77
+
"value": 35.726545156,
78
+
"_ts": 1605862991
79
+
}
80
+
```
81
+
82
+
To use the `_ts` value, you must multiply the value by 1,000 since the timestamp is expressed in seconds.
0 commit comments