time

Time-of-day part of a calendar duration, as a duration.

Category: Language Fundamentals > Data Types

Syntax

t = time(caldur)

Returns the time component of caldur.

Description

A calendarDuration has three parts: months, days and time. The months and days depend on the calendar (a month can be 28 to 31 days), but the time part is an exact amount of time. time extracts that last part as a regular duration, in hh:mm:ss display.

For calendarDuration(1, 2, 3, 4, 5, 6), which is 1 year, 2 months, 3 days, 4 hours, 5 minutes and 6 seconds, time returns 04:05:06.

Input arguments

caldur
calendarDuration array.

Output arguments

t
Duration array holding only the hours, minutes and seconds portion.

Example

Time part of a calendar duration

c = calendarDuration(1, 2, 3, 4, 5, 6);
t = time(c)
class(t)
Output
t = duration
   04:05:06
ans = 'duration'

See also

calendarDuration duration timeofday caldiff split