Problem with timestamp when I use thingspeakwrite | MATLAB IoT Analytics | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Problem with timestamp when I use thingspeakwrite
No permission to create posts
September 4, 2018
8:38 pm
Avatar
kikorojo
New Member
Members
Forum Posts: 2
Member Since:
February 28, 2017
sp_UserOfflineSmall Offline

Hello,

I have problems with the time stamps. What I wanted to do is to send data that I have in my laptop to Thingspeak, so I can visualize it in the web. I need that the time stamp of the data that appear in thingspeak be the same as the one that the data have in my laptop, which is the time where the data was created in the first place. However, Thingspeak shift the time to adjust for local time which is a problem in my case, because I have weather data and I don't want my solar radiation sensor peak at 5-6 am.

As an example, when I upload the data from Matlab using thingspeakwrite with a time stamp of 04-Sep-2018 16:23:43 , in Thingspeak appear shifted to 04-Sep-2018 08:23:43 (UTC -7), then when I download the same data using the data export button, this value appear shifted again to 04-Sep-2018 12:23:43 (UTC-3). What I would really like to have is the option that Thingspeak maintain the timestamp instead of keep changing it. Is there a way to do this? Can I configure the UTC time in Thingspeak or in Matlab? It seem that one way to control the shift is changing my laptop local time, but hopefully there will be a better option as a rather prefer to maintain my laptop at the correct time.

I can see that there is an option in the data import/export label to modify the UTC time, but it seems that this is just for manually upload data to Thingspeak which is not what I want to do.

Thank you very much for the help.

September 18, 2018
8:46 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

The REST call for readData will allow you to use timezones.
https://www.mathworks.com/help/thingspeak/readdata.html

In MATLAB, you could do something like this (replace and api key):
url='https://api.thingspeak.com/channels//feeds.json?api_key=XXXXXXXXXXXXXXXX&timezone=America/New_York&results=2'
myData=webread(url);

The full list of timezones is here:
https://www.mathworks.com/help/matlab/ref/datetime.html?searchHighlight=datetime&s_tid=doc_srchtitle#buhzxmk-1-TimeZone

The datetime read in this method will preserve the timezone information. When you re-upload it, ThingSpeak keep the same format.

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
23 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

qkpham, SANGAMNATH B, swatiiot, kalyanigaware16@gmail.com, Romi, Drakan01

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457