Difference between local time and "created_at
4 次查看(过去 30 天)
显示 更早的评论
Hello
The time returned by "created_at" does not correspond to the local time
e.g. 18:54:33.401 -> Message:{"channel_id":2499901, "created_at": "2024-08-21T16:54:31Z"....}
although my profile is correctly filled in, the time indicated on the plot is correct
Should I add the term: ?timezone = Europe%2FParis
if where please I do not have a field in "channel setting" to add it
Thank you in advance.
0 个评论
回答(2 个)
Walter Roberson
2024-8-21
"2024-08-21T16:54:31Z"
The Z at the end of the timestamp specifically means "Zulu" time, which is UTC.
It would be expected that times in that format would be converted to be in timezone UTC. To plot them in local time, you would need to change the TimeZone property of the data.
Star Strider
2024-8-21
To illustratte —
TZ = timezones("Europe");
disp(TZ)
MessageTime = datetime("2024-08-21T16:54:31Z", 'InputFormat','yyyy-MM-dd''T''HH:mm:ssZ', 'TimeZone','Europe/Paris')
.
4 个评论
Star Strider
2024-8-22
I have no experience with ThingSpeak.
One option —
dts = extractBetween('{"channel_id":2499901,"created_at":"2024-08-22T11:48:14Z","entry_id":34325,"field1":"34.10","field2":"34.40","field3":"69","field4":"27.81","field5":null,"field6":null,"field7":null,"field8":null,"latitude":null,"longitude":null,"elevation":null,"status":null}', '"created_at":',',')
MessageTime = datetime(dts{:}, 'InputFormat','"yyyy-MM-dd''T''HH:mm:ssZ"', 'TimeZone','Europe/Paris')
I am not certain how to extract that particular information (the Message cell array to use in the extractBetween call) from whatever ThingSpeak returns, however if you can do that, this approach should work.
.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Visualize Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!