Difference between local time and "created_at
32 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
Walter Roberson
le 21 Août 2024 à 17:13
"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
le 21 Août 2024 à 18:53
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 commentaires
Star Strider
le 22 Août 2024 à 12:39
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.
.
Voir également
Catégories
En savoir plus sur Dates and Time dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!