totime(X;Y)

Convert a string, date+time, or time to a time value in the form HHMMSS. (Available as of version 15.19)

Syntax

totime(X;Y)

Input

Argument Type Description
X any A scalar value or the name of a column containing date-related values
Valid values can be of the form:
  • string
  • date+time
  • time
Y text An optional argument indicating how to display the results

Valid values are:

  • 'allow24' - Allow 24-hour time, such as the string '24:00:00'
  • 'forbid24' - Forbid 24-hour time and return an error when attempting to convert 24-hour time
  • 'rollover' - Allow 24-hour time, but convert times 24:00:00 and over, so that '24:00:00' is converted to 0 and '36:13:14' is converted to 121314.

totime(X;Y) can take a variety of input values. It allows a date+time value, discarding the date portion. It will also accept fractional seconds values, such as '12:23:44:123', but will truncate the time to HHMMSS format.

Return Value

Returns an integer value in the form HHMMSS that can be expressed in a time format (such as type:hms24).

For more information about date formats, see Dates and time.

If the input values are not in one of the supported formats listed above, the function returns an erroneous or illogical output.

Example

The following example converts strings containing times to the date format hms12. The Y argument is 'rollover', so that it accepts any positive values and rolls over the time into an AM or PM time.

<table cols="timetext">
"24:00:00"
"36:13:14"
"11:45:10"
"14:56:03" 
</table>

<willbe name="timeconverted" value="totime(timetext;'rollover')" format="type:hms12"/>