Mapping Toolbox | ![]() ![]() |
Convert times between different units
Syntax
timeout = timedim(anglin,from,to)
Description
timeout = timedim(timein,from
,to
) returns the value of the input time timein
, which is in units specified by the valid time units string from
, in the desired units given by the valid time units string to
. Valid time units strings are:
'hours' or 'hr' for decimal hours 'seconds' or 'sec' for seconds 'hms' for hours-minutes-seconds 'hm' for hours-minutes
Examples
Convert from hours to seconds:
timedim(2.56,'hours','seconds') ans = 9216
What is the difference between hms and hm? (best displayed in bank format)
format bank
timedim(2.56,'hours','hms')
ans =
233.36
timedim(2.56,'hours','hm')
ans =
234.00
The hm answer is the hms answer correctly rounded to whole minutes
(i.e., rounded based on 60 seconds per minute, not 100).
See Also
angledim |
Convert angle units |
distdim |
Convert distance units |
hr2hms hr2sec |
Other direct time conversion functions |
time2str |
Convert time to selected display string |
![]() | time2str | timezone | ![]() |