这对我来说没有意义:
caldays(1); %I get here by running this: between(datetime, datetime+days(1))
%ans =
%
% calendarDuration
%
% 1d
time(caldays(1))
%ans =
%
% duration
%
% 00:00:00
在保留天,月和年的同时,如何实际将calendarDurations转换为持续时间?我在Mathworks帮助上找不到此内容。
目的是比较自开始日期起是否经过了一定的分钟数。
谢谢
答案 0 :(得分:0)
如果您希望使用duration
而不是calendarDuration
,则可以直接使用:
duration = days(1)
检查自start_date
以来是否经过了一定的分钟数:
now = datetime
is_5_minutes_passed = (now - start_date) >= minutes(5)
更新:
[d,t] = split(calendarDuration, {'days','time'})
duration = days(d) + t
现在您有了一个duration
数组。