How do I convert a datetime array to a cell array of strings?

40 views (last 30 days)
I have an array of datetimes. How do I convert this to a cell array of strings or character vectors?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 17 Dec 2019
The best way to convert a datetime array to a cell array is to use the "cellstr" function:
For example,
>> DateStrings = {'2014-05-26';'2014-08-03'};
>> t = datetime(DateStrings,'InputFormat','yyyy-MM-dd')
>> t_cell = cellstr(t)

More Answers (0)

Categories

Find more on Dates and Time in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!