How to correctly specify timezone in REST call for a channel

17 views (last 30 days)
In the READ calls for the REST API, there is no mention in the docs for start and end what timezone these are in. My guess is it's either in the timezone of the device, or GMT but it does not explicitly say. I tried setting the timezone to GMT using the timezonep parameter, but then I get no results at all. Here is my encoded string with the auth XXX'd out.
  1 Comment
David Stacer
David Stacer on 10 Dec 2021
I think all of the data is stored with a UTC time stamp. I tested a bit and without a timezone= parameter the data had a created_at field that looked like 2021-12-10 10:00:34 UTC . When I specified a timezone=America/New_York the created_at field looked 12/10/2021 10:00. I had ask for data starting at 10:00 am.
The data was different since the first query was giving me UTC time and second was giving the correct offset to the timesone the sensor was in.
Try without the timezone parameter and see if your resulting data "created_at" field looks like what I got. 2021-12-10 10:00:34 UTC << timezone in the date/time format.
Seems like the created_at result should always contain the timeszone but it doesn't look like it does.

Sign in to comment.

Answers (1)

Peter Kellner
Peter Kellner on 11 Dec 2021
I think you are right David. I checked the latest incoming data and it appears that it's UTC. It would be nice if it were clearly documented.

Communities

More Answers in the  ThingSpeak Community

Categories

Find more on Read Data from Channel 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!