time2Str Function

Converts a time specified as the number of seconds elapsed since midnight to a text string that includes hours, minutes, and seconds.


str time2Str(
    int _time,
    int _separator,
    int _timeFormat

Parameter

Description

_time

The number of seconds since midnight.

_separator

The characters to be used as separators in the text string. Possible values follow:

  • 0 – regional settings for the operating system

  • 1 – colon (:)

  • 2 – point (.)

  • 3 – space ( )

  • 4 – comma (,)

  • 5 – forward slash (/)

_timeFormat

Determines whether a 12-hour or 24-hour clock is used. Possible values follow:

  • 0 – regional settings for the operating system

  • 1 – 24-hour clock (15:00:00)

  • 2 – 12-hour clock (3:00:00pm)

The string that represents the time.

// Returns the text string 05:01:38.
time2Str(18098,1,1);
// Returns the text string 05:01:38 am.
time2Str(18098,1,2);
// Returns the text string 05 01 39.
time2Str(18099,3,1);
// Returns the text string 05/01/39 am.
time2Str(18099,5,2);

Community Additions

ADD
Show: