Mapping Toolbox    
time2str

Convert time to a clock string

Syntax

Description

The purpose of this command is to make time-valued variables into strings suitable for map display.

str = time2str(timein) converts a numerical vector of times to a string matrix. The output string matrix is useful for the display of times.

str = time2str(timein,clock) uses the specified clock input to construct the string matrix. Allowable clock strings are '24' (default) for a 24-hour clock, '12' for a 12-hour clock, and 'nav' for a navigational hour clock.

str = time2str(timein,clock,format) uses the specified format input to construct the string matrix. Allowable for format strings are 'hms', for hours, minutes, and seconds, and 'hm' (default), for hours and minutes.

str = time2str(timein,clock,format,units) defines the units in which the input times are supplied. Any valid time units string can be entered. If omitted, 'hours' is assumed.

str = time2str(timein,clock,format,digits) indicates the power of ten to be included for the seconds (if format = 'hms') or minutes (if format = 'hm'). The default value is 0, so nothing is returned to the right of the decimal (100 is the ones column). For example, if digits = -2, seconds would be returned down to the hundredths column.

Examples

13 hours, 56 minutes, 44 seconds in hms format is 1356.44.

For hm format, appropriate rounding occurs:

The 24-hour and navigational representations:

Navigational times are four digits; if seconds are included, they are rounded to the nearest 15 seconds, which are represented by tick marks (0=none, 15=', 30='', 45=''').

Consider the hms format time 1356.4456 for rounding purposes:

See Also
hr2hms
hr2sec
Other direct time conversion functions
timedim
Convert times between different units


  tightmap timedim