Splitting time into hours : minutes : seconds from a fractional value.

23 visualizaciones (últimos 30 días)
Hello Everyone,
Can anyone help me for converting a fractional value in the time format?
e.g. 15.76 = HH:MM:SS format.

Respuesta aceptada

Stephan
Stephan el 19 de Abr. de 2021
I guess 15.76 means hours in decimal numbers:
[h,m,s] = hms(hours(15.76))
d = duration(h,m,s)
gives:
h =
15
m =
45
s =
36
d =
duration
15:45:36
  2 comentarios
Walter Roberson
Walter Roberson el 19 de Abr. de 2021
t = hours(15.76);
t.Format = 'hh:mm:ss'
t = duration
15:45:36
WASIM ASHRAF
WASIM ASHRAF el 21 de Abr. de 2021
Thanks Stephan, due to this small code my full problem was stuck. Now my code is working fine.
Thanks a lot.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by