Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.0.0 - Português


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

mi = minutes(0:10)
val = minutes(mi)

Duration in seconds

sc = seconds(0:5:10)
val = seconds(sc)

Duration in milliseconds

milsec = milliseconds(0:100:500)
val = milliseconds(milsec)

Duration in days

d = days(1:7)
val = days(d)

d1 = duration(12, 30, 45)
d2 = hours(12) + minutes(30) + seconds(45);
d1 == d2

duration(1, 0, 0):minutes(15):duration(2, 0, 0)

// with datetime
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
Report an issue
<< getdate Data e Hora isnat >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Oct 24 14:35:27 CEST 2023