How do I convert this string to a date ?
43 views (last 30 days)
Hi everybody !
I'm trying to turn this string to a date (from a txt file): 2021-05-11T14:11:00Z to 'yyyy-MM-dd HH:mm:ss'.
I tried with datetime(ref_time(h, 1),'InputFormat', 'yyyy-MM-dd e HH:mm:ss e','Format','yyyy-MM-dd HH:mm:ss') with an 'e' replacing the 'T' and 'Z' but id doesn't work...
Asmit Singh on 26 May 2021
Since you are trying to convert strings to date with literals like 'T' and 'Z', you may want to look at the "Date and Time from Text with Literal Characters" section in the documentation.
The below code converts the given string format to matlab datetime variable.
myDate = "2021-05-11T14:11:10Z"