Difference between local time and "created_at

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.

Respuestas (2)

Walter Roberson
Walter Roberson el 21 de Ag. de 2024

0 votos

"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.

1 comentario

noone Me
noone Me el 22 de Ag. de 2024
Thanks Walter but I don't know where to change the topic to read "2024-08-21T16:54:31:+02.00".

Iniciar sesión para comentar.

To illustratte —
TZ = timezones("Europe");
disp(TZ)
Name Area UTCOffset DSTOffset ______________________ ______ _________ _________ {'Europe/Amsterdam' } Europe 1 1 {'Europe/Andorra' } Europe 1 1 {'Europe/Astrakhan' } Europe 4 0 {'Europe/Athens' } Europe 2 1 {'Europe/Belgrade' } Europe 1 1 {'Europe/Berlin' } Europe 1 1 {'Europe/Bratislava' } Europe 1 1 {'Europe/Brussels' } Europe 1 1 {'Europe/Bucharest' } Europe 2 1 {'Europe/Budapest' } Europe 1 1 {'Europe/Busingen' } Europe 1 1 {'Europe/Chisinau' } Europe 2 1 {'Europe/Copenhagen' } Europe 1 1 {'Europe/Dublin' } Europe 0 1 {'Europe/Gibraltar' } Europe 1 1 {'Europe/Guernsey' } Europe 0 1 {'Europe/Helsinki' } Europe 2 1 {'Europe/Isle_of_Man'} Europe 0 1 {'Europe/Istanbul' } Europe 3 0 {'Europe/Jersey' } Europe 0 1 {'Europe/Kaliningrad'} Europe 2 0 {'Europe/Kiev' } Europe 2 1 {'Europe/Kirov' } Europe 3 0 {'Europe/Lisbon' } Europe 0 1 {'Europe/Ljubljana' } Europe 1 1 {'Europe/London' } Europe 0 1 {'Europe/Luxembourg' } Europe 1 1 {'Europe/Madrid' } Europe 1 1 {'Europe/Malta' } Europe 1 1 {'Europe/Mariehamn' } Europe 2 1 {'Europe/Minsk' } Europe 3 0 {'Europe/Monaco' } Europe 1 1 {'Europe/Moscow' } Europe 3 0 {'Europe/Oslo' } Europe 1 1 {'Europe/Paris' } Europe 1 1 {'Europe/Podgorica' } Europe 1 1 {'Europe/Prague' } Europe 1 1 {'Europe/Riga' } Europe 2 1 {'Europe/Rome' } Europe 1 1 {'Europe/Samara' } Europe 4 0 {'Europe/San_Marino' } Europe 1 1 {'Europe/Sarajevo' } Europe 1 1 {'Europe/Saratov' } Europe 4 0 {'Europe/Simferopol' } Europe 3 0 {'Europe/Skopje' } Europe 1 1 {'Europe/Sofia' } Europe 2 1 {'Europe/Stockholm' } Europe 1 1 {'Europe/Tallinn' } Europe 2 1 {'Europe/Tirane' } Europe 1 1 {'Europe/Ulyanovsk' } Europe 4 0 {'Europe/Uzhgorod' } Europe 2 1 {'Europe/Vaduz' } Europe 1 1 {'Europe/Vatican' } Europe 1 1 {'Europe/Vienna' } Europe 1 1 {'Europe/Vilnius' } Europe 2 1 {'Europe/Volgograd' } Europe 3 0 {'Europe/Warsaw' } Europe 1 1 {'Europe/Zagreb' } Europe 1 1 {'Europe/Zaporozhye' } Europe 2 1 {'Europe/Zurich' } Europe 1 1
MessageTime = datetime("2024-08-21T16:54:31Z", 'InputFormat','yyyy-MM-dd''T''HH:mm:ssZ', 'TimeZone','Europe/Paris')
MessageTime = datetime
21-Aug-2024 18:54:31
.

4 comentarios

noone Me
noone Me el 22 de Ag. de 2024
Thanks Star Striderr,
but I don't know where to put this additional information in my channel.
I'm in MQTT via ESP32, the dating of the curves on the trace is correct but the message still sends GMT.
Where should I make the change please?
Star Strider
Star Strider el 22 de Ag. de 2024
I do not understand what you are doing.
I demonstrated a way to convert the time you have to the time you want. You probably need to keep the Z time in your application.
noone Me
noone Me el 22 de Ag. de 2024
RE..
I'm sorry (thanks again for your help) but I don't know where to put the "MessageTime" that you programmed for me. I'm new to ThingSpeack and the topic I've received is as follows:
13:48:15.884 -> Message arrived from the topic: channels/2499901/subscribe
13:48:15.884 -> Message:{"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}
Where can I take action to change the "created_at" please ?
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":',',')
dts = 1x1 cell array
{'"2024-08-22T11:48:14Z"'}
MessageTime = datetime(dts{:}, 'InputFormat','"yyyy-MM-dd''T''HH:mm:ssZ"', 'TimeZone','Europe/Paris')
MessageTime = datetime
22-Aug-2024 13:48:14
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.
.

Iniciar sesión para comentar.

Categorías

Más información sobre Read Data from Channel en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 21 de Ag. de 2024

Comentada:

el 22 de Ag. de 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by