How to get string that uses datetime Format property?
Show older comments
Note: I posted this question to the newsgroup as well. I'm not sure which is the more appropriate forum.
Is there a way to get string variable that is equivalent to the output of the disp method for a datetime object, which is written to the command line interface? I'd like to print formatted strings from datetime arrays to a file, but fprintf says that it is not defined for datetime inputs.
1 Comment
Guillaume
on 28 Sep 2015
forum and newsgroup are as appropriate. Use whichever you prefer or both.
Accepted Answer
More Answers (1)
Peter Perkins
on 28 Sep 2015
0 votes
Bruce, in your C.S-S.M post, you said, "write data and labels to a file". It's worth noting that if you have everything in a table, writetable will automatically write out the datetimes to the file with no conversion necessary. It uses the format and the timezone that the datetime variable in the table is set to, so if you want both a local and a UTC timestamp in the file, you'd have to have two datetime variables in the table.
1 Comment
Bruce Elliott
on 28 Sep 2015
Categories
Find more on Data Type Identification 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!