Chris in Discussions
최근 활동: 2021년 6월 2일

The timestamp for the ThingSpeak Alerts I create look like this: "Time: 2021-06-01 06-21-45.001 -04:00" Using a dash (-) instead of a colon (:) between the hour and minutes and minutes and seconds seems very non-standard to me. I've always seen it with a colon. Is there any way to change the dashes in the time part of the stamp to colons so the above looks like 06:21:45.001? (I presume this is set in "HeaderFields" but don't know how to change it. Thanks. Change Time Format in ThingSpeak Alert? Can you show how you are generating that timestamp with an alert? I think the standard ThingSpeak format is ISO 8601. The created_at timestamps generally adhere to this, and seen in this snippet from the <https://www.mathworks.com/help/thingspeak/writedata.html write data page> . (Optional) Date when feed entry was created, in ISO 8601 format, for example: 2014-12-31 23:59:59. The date you specify must be unique within the channel. Time zones can be specified using the timezone parameter. This comes out of a MATLAB Analyis: alert_url= "https://api.thingspeak.com/alerts/send"; jsonmessage = sprintf(['{"subject": "%s", "body": "%s"}'], alert_subject,alert_body); options = weboptions("HeaderFields", {'Thingspeak-Alerts-API-Key', alert_api_key; 'Content-Type','application/json'}); result = webwrite(alert_url, jsonmessage, options); See this link: https://www.mathworks.com/help/thingspeak/analyze-channel-data-to-send-email.html on which it is based. The time has the same format in that example. Thanks for pointing that out to me. You cannot change the format of the timestamp part of the response, but you can add a timestamp to the body message. For example, on the line that says alertBody = ' No water needed. '; you can add a timestamp. 'No water needed at 2021-06-01 12:43:24 You can use <https://www.mathworks.com/help/matlab/ref/datetime.html datetime> with a format specifier to put the timestamp however you like it. Then add it to the alert body using <https://www.mathworks.com/help/matlab/ref/sprintf.html sprintf> . OK, but is there a way to eliminate the default timestamp if I create my own? If so, please describe. Or do I end up with two timestamps--one formatted normally, and one with the odd default format? If so, I would hope you will consider changing the default. I will log your request. Can you describe why you need the timestamp? Are you parsing the response with some other code? Thanks. I am not parsing the response. I am using the alert to tell me about the time of a fault in a monitored system. I would rather use the time in the alert than the time of receipt of the email for that purpose. Why does the format matter if you are not parsing the response? bEcAuse I AM rEAding the RespoNSE and wouLD LIKe it in A norMAL formAT, oK? time format alert
black in MATLAB Answers
최근 활동: 2019년 9월 22일

I want to label the time axis in a plot with "ddd: HH" (speak "first three letters of the day, then the two digits for the hour in 24-hour format). However, when doing this, the format is applied for some labels, but otheres also print more information like month, day and year. % generate time sequence, last 3 days, 12 hours offset xtickformat('eee: HH') t2 = datetime('today'), t1 = t2-days(3) xData = t1:hours(12):t2 set(gca,'xtick',xData) Leads to:

ThingSpeak 정보

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.