datetime loosing midnight timestamps
Latest activity Reply by Marc Hanssens
on 31 Jul 2023
I am getting a NaT from the datetime function because it doesn't interpretp the date as a date/time?
I currently use this data (time) as this:
{'2023-07-26T23:00:00Z'}
{'2023-07-26T23:30:00Z'}
{'2023-07-27' }
{'2023-07-27T00:30:00Z'}
{'2023-07-27T01:00:00Z'}
and I get tStamps as this:
27-Jul-2023 09:00:00
27-Jul-2023 09:30:00
NaT %how do I not get this NaT? but 27-Jul-2023 10:00:00 which is 27-Jul-2023 00:00:00 gmt/utc
27-Jul-2023 10:30:00
27-Jul-2023 11:00:00
using this code for the datetime function
infmt ='yyyy-MM-dd''T''HH:mm:00Z';
tStamps = datetime(time,"InputFormat",infmt,'TimeZone','Australia/Brisbane');
5 Comments
Time DescendingIs the datetime cell array you show returned from ThingSpeak?
What happends if you seperate the format and time zone operations?
Worst case plan might be to scan for the value 9:30 and then just fix the next one in your code.
it looks like fillmissing might be able to be used to fill the missing time with T00:00:00Z but I can't find a good example of this?
Sign in to participate