hours

Duration in hours, or the number of hours in a duration.

Category: Language Fundamentals > Data Types

Syntax

d = hours(x)

Creates a duration of x hours from a number.

x = hours(d)

Converts a duration d to a number of hours.

Description

hours(1.5) is a duration of one and a half hours, and it combines with other durations or datetimes by ordinary arithmetic: hours(2) + minutes(30). Applied to a duration, hours goes the other way and returns a plain number, so hours(minutes(90)) is 1.5.

Input arguments

x
Numeric array of hours (may be fractional).
d
duration array.

Output arguments

d
duration array in hours display format.
x
Double array.

Example

Both directions

d = hours(90)
hours(duration(2, 30, 0))
hours(0.5) + minutes(15)
Output
d = duration
   90 hr
ans = 2.5000
ans = duration
   0.75 hr

See also

minutes seconds days duration hour