hours
convert reals in hours (duration)
convert hours in reals
minutes
convert reals in minutes (duration)
convert minutes in reals
seconds
convert reals in seconds (duration)
convert seconds in reals
milliseconds
convert reals in milliseconds (duration)
convert milliseconds in reals
days
convert reals in days (duration)
convert days in reals
years
convert reals in years (duration)
convert years in reals
Syntax
res = hours(x)
res = hours(d)
res = minutes(x)
res = minutes(d)
res = seconds(x)
res = seconds(d)
res = milliseconds(x)
res = milliseconds(d)
res = days(x)
res = days(d)
res = years(x)
res = years(d)
Arguments
- x
real scalar or matrix representing a time unit
- d
duration object
- res
duration object or real matrix
Description
h = hours(d) creates a duration in hours of the same size as the input argument d.
If d is a duration, then hours(d) returns a matrix of reals.
It is the same for the other functions.
Examples
Duration in hours
h = hours(0:2:12)
val = hours(h)
Duration in minutes
Duration in seconds
Duration in milliseconds
Duration in days
d1 = duration(12, 30, 45)
d2 = hours(12) + minutes(30) + seconds(45);
d1 == d2
duration(1, 0, 0):minutes(15):duration(2, 0, 0)
datetime(2022, 1, 1):hours(1):datetime(2022, 1, 2)
See also
- duration — create a duration - duration in hours, minutes and seconds
- datetime — create points in time
History
Version | Description |
2024.0.0 |
Introduction in Scilab. |