how to convert datetime array to double

9 次查看(过去 30 天)
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 个评论
Peter Perkins
Peter Perkins 2019-6-4
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 2020-2-17
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.

请先登录,再进行评论。

回答(1 个)

madhan ravi
madhan ravi 2019-5-11

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by