MATLAB Help Center
Convert time of calendar duration to duration
t = time(d)
t = time(d) returns the time components of the calendar duration values in d as durations. The t output is the same size as d.
d
t
example
collapse all
Create an array of calendar durations.
d = caldays(8:10) + hours(1.2345)
d = 1×3 calendarDuration 8d 1h 14m 4.2s 9d 1h 14m 4.2s 10d 1h 14m 4.2s
Convert the time components of the array to durations.
t = 1×3 duration 01:14:04 01:14:04 01:14:04
View the data type of t.
whos t
Name Size Bytes Class Attributes t 1x3 40 duration
Input calendar duration, specified as a scalar, vector, matrix, or multidimensional calendarDuration array.
calendarDuration
expand all
The time function fully supports tall arrays. For more information, see Tall Arrays.
time
backgroundPool
ThreadPool
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Introduced in R2014b
calyears | calquarters | calmonths | calweeks | caldays | duration
calyears
calquarters
calmonths
calweeks
caldays
duration
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
Europe
Asia Pacific
Contact your local office