how to convert datetime array to double

12 vues (au cours des 30 derniers jours)
awhan 99
awhan 99 le 11 Mai 2019
Commenté : Robert Garnett le 17 Fév 2020
How can I convert the datetime array to Double? for example,
>> dt = datetime( '08:07:53', 'InputFormat', 'HH:mm:ss' );
>> dt.Format = 'HH:mm:ss';
>> T1 = (dt + hours(1:5)+seconds(1:5))'
Thanks!!
  2 commentaires
Peter Perkins
Peter Perkins le 4 Juin 2019
You probably don't need to convert to double. What are you trying to do?
You almost certainly do not want to convert '08:07:53' to a datetime, unless you mean "08:07:53 today", where the definition of "today" changes every day.
Robert Garnett
Robert Garnett le 17 Fév 2020
If you want to use gridded interpolation of a variable versus a datetime array you have to convert the date to double viz:
Error using griddedInterpolant
The input points must be a single or double array.

Connectez-vous pour commenter.

Réponses (1)

madhan ravi
madhan ravi le 11 Mai 2019

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by