Altair® Monarch®

 

Function: SecondsToChar

Description

Converts a number of seconds to a time string.

Syntax

SecondsToChar(seconds)

Arguments

seconds can be a constant, a numeric field, an expression that results in a number or a function that returns a number representing the number of seconds since 12:00AM.

Return value

This function returns a string representing the time of day, in the format specified by the Windows Regional Time settings. If the number is greater than or equal to the number of seconds in a day (86400), the number is adjusted by dividing by 86400, with only the remainder passed as the argument to the function.

Calculated field example

To add 45 minutes to each value in the Start_time field -- assuming that this field’s values are represented as time strings, such as 12:10pm -- you could use the following calculated field expression: SecondsToChar(CharToSeconds(Start_time)+(45*60))

This expression first converts each Start_time value to a number of seconds since midnight using the CharToSeconds function. Then 45 minutes are added by adding the appropriate number of seconds to this value. Finally, the value is converted back to a time string.