ThingSpeak data has wrong Time Zone
Show older comments
My pofile has the Time Zone set to US Mountain (GMT-07:00), but the data is being displayed with US Pacific time (GMT-08:00). I am not encoding any explict time or zone information with my data.
How do I get the data to display in Mountain Time?
8 Comments
Christopher Stapels
on 9 Sep 2022
What is the time zone setting on the computer you are using?
Bernard FluscheJr
on 11 Sep 2022
Christopher Stapels
on 13 Sep 2022
The ThingSpeak plots use your computer setting.
You can use a custom MATLAB visualization and the code provided by Seth below to create a chart with a display in your desired time zone.
There is a time zone parameter in the Charts API, but I feel it is still subordinate to the computer time zone, so that might not help.
Andrew Clark
on 18 Aug 2023
Hi Christopher, I have a similar issue with timezone. My profile and computer are both Pacific (GMT-800), and my data sent to Thingspeak via the Arduino API sets the "CreatedAt" field to the same - GMT-800)
...
timestamp += "-0800"; // add UTC adjustment for Pacific TZ
...
ThingSpeak.setCreatedAt(timestamp);
...
But the CreatedAt timestamp I see in both Export Recent Data and data Export both show GMT-700, off by 1 hour. Any ideas? Thanks!
2023-08-17 21:16:55 -0700,233,0,0,0,68.47372,73.41690,37.87529,-122.54132,476
2023-08-17 21:17:36 -0700,234,0,0,0,68.42805,73.46725,37.87536,-122.54131,469
2023-08-17 21:18:15 -0700,235,0,0,0,68.48093,73.32153,37.87531,-122.54137,475
2023-08-17 21:18:55 -0700,236,0,0,0,68.45529,73.45022,37.87535,-122.54139,480
2023-08-17 21:19:35 -0700,237,0,0,0,68.37759,73.60687,37.87540,-122.54137,469
2023-08-17 21:20:15 -0700,238,0,0,0,68.34154,73.55652,37.87535,-122.54137,481
Vinod
on 18 Aug 2023
Go here and set your timezone to match your setting:
Christopher Stapels
on 18 Aug 2023
@Andrew Clark How are you setting the timezone for your arduino? Is there a chance its creating timestamp with an hour offset already or somewhere else in your code?
Timezone and date stuff is usually rough to track down. Can you try updating using the API from a web browser and see if you see the same result?
Andrew Clark
on 18 Aug 2023
Hi, yes, I thought of that. As you can see in the code I supplied in my query, I set the timezone explicitly to "-800" per the Thinkspeak protocol when I set the "Created_At" field (I am using an RTC to get more accurate timestamps on the data.)
timestamp += "-0800"; // add UTC adjustment for Pacific TZ
...
ThingSpeak.setCreatedAt(timestamp);
Is there a conflict between setting CreatedAt and the Thingspeak Profile? Should I stop setting the timezone in my CreatedAt field in the above Arduino code?
Another clue that might help: just now I set the Profile timezone to "-900 (Alaska)" and the timestamps all changed to the correct timezone - "-800"! So something is causing the time to be off by one hour.
Christopher Stapels
on 28 Sep 2023
ThingSpeak plots in your browser window will generally take the timezone set for your computer.
Answers (2)
Vinod
on 18 Aug 2023
Moved: Christopher Stapels
on 18 Aug 2023
1 vote
Go here and set your timezone to match your setting:
1 Comment
Andrew Clark
on 18 Aug 2023
Hi Vinod, my Profile looks to be set properly to Pacific:

so, looking for something else...thanks!
dt = datetime(2022,1,1,12,0,0,"TimeZone","Etc/GMT-8")
dt.TimeZone = "Etc/GMT-7"
Communities
More Answers in the ThingSpeak Community
Categories
Find more on ThingSpeak in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!