Can't convert a cell array to a date using cellfun(@datenum or @datetime)
Afficher commentaires plus anciens
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)));
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Dates and Time dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!