duration

Methods

Method Reference: duration.floor

duration: Y = floor (D)
duration: Y = floor (D, unit)

Round toward negative infinity for duration arrays.

Y = floor (D) rounds each element of the duration array D to the largest integer number of seconds not greater than that element.

Y = floor (D, unit) rounds each element of the duration array D to the largest integer number of the specified unit of time not greater than that element. unit must be one of the following values:

  • 'seconds' (default)
  • 'minutes'
  • 'hours'
  • 'days'
  • 'years'

Source Code: duration

Example: 1

floor rounds a duration down to a whole unit (default: seconds).

 d = hours (2.9)
d =
  duration

   2.9 hr
 floor (d, 'hours')
ans =
  duration

   2 hr