MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
Value of Format Description
'y' Number of exact fixed-length years. A fixed-length
year is equal to 365.2425 days.
'd' Number of exact fixed-length days. A fixed-length day
is equal to 24 hours.
'h' Number of hours
'm' Number of minutes
's' Number of seconds

To specify the number of fractional digits displayed, use the format function.

To display a duration in the form of a digital timer, specify one of the following character
vectors.


  • 'dd:hh:mm:ss'

  • 'hh:mm:ss'

  • 'mm:ss'

  • 'hh:mm'


You also can display up to nine fractional second digits by appending up to nine S
characters. For example, 'hh:mm:ss.SSS' displays the milliseconds of a duration value
to 3 digits.

Changing the Format property does not change the values in the array, only their display.

calendarDuration Display Format


Specify the Format property of a calendarDuration array as a character vector that
can include the characters y, q, m, w, d, and t, in this order. The format must include m, d,
and t.

This table describes the date and time components that the characters represent.

Character Unit Required?
y Years no

7 Dates and Time

Free download pdf