Can't convert a cell array to a date using cellfun(@datenum or @datetime)
Show older comments
Hi there,
I have a cell array that looks like:
'2012-03-12 00:00:00 UTC'
'2010-09-06 00:00:00 UTC'
'2010-10-24 00:00:00 UTC'
'2010-09-06 00:00:00 UTC'
'2012-02-06 00:00:00 UTC'
'2010-09-06 00:00:00 UTC'
'2012-05-22 00:00:00 UTC'
'2011-09-23 00:00:00 UTC'
'2011-06-21 00:00:00 UTC'
'2012-05-30 00:00:00 UTC'
'2012-05-31 00:00:00 UTC'
'2010-10-15 00:00:00 UTC'
And I am trying to use a function that will take the difference between the 16th of December and that date, in terms of days. I am trying this function but get an error which is
Error using datetime (line 602) Could not recognize the format of the date/time string '2012-03-12 00:00:00 UTC'. You can specify a format string using the 'InputFormat' parameter. If the string contains day, month, or time zone names in a language foreign to the 'en_US' locale, those might not be recognized. You can specify a different locale using the 'Locale' parameter.
Here is my code snippet:
sincesignedup = days(datenum(2015,12,16,10,53,00)-datenum(cellfun(@datetime,finalnbs.signed_up_atEST)));
Accepted Answer
More Answers (0)
Categories
Find more on Dates and Time 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!