Difference between local time and "created_at
32 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (2)
Walter Roberson
il 21 Ago 2024 alle 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
il 21 Ago 2024 alle 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 Commenti
Star Strider
il 22 Ago 2024 alle 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.
.
Vedere anche
Categorie
Scopri di più su Dates and Time in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!