dt = 1x3 duration
61:47:22
85:47:22
109:47:22
whos dt
Name
Size
Bytes Class
Attributes
dt
1x3
40 duration
dt contains durations in the format, hours:minutes:seconds.
View the elapsed durations in units of days by changing the Format property of dt.
dt.Format = 'd'
dt = 1x3 duration
2.5746 days
3.5746 days
4.5746 days
Scale the duration values by multiplying dt by a factor of 1.2. Because durations have an exact
length, you can multiply and divide them by fractional values.
dt2 = 1.2*dt
dt2 = 1x3 duration
3.0895 days
4.2895 days
5.4895 days
Calculate Elapsed Time in Calendar Units
Use the between function to find the number of calendar years, months, and days elapsed between
two dates.
t1 = datetime('today')
t1 = datetime
01-Sep-2021
t2 = t1 + calmonths(0:2) + caldays(4)
t2 = 1x3 datetime
05-Sep-2021
05-Oct-2021
05-Nov-2021
dt = between(t1,t2)
dt = 1x3 calendarDuration
4d
1mo 4d
2mo 4d
See Also
between | diff | caldiff
7 Dates and Time
7-32
Précédent

- 286/1450

Suivant