Cicode Programming Reference > Cicode Function Categories > String Functions Introduction > StrToTime


Converts a "time" string into a time/date variable. The value returned is the number of seconds from midnight. You can add this value to the date to get the current time value. To set the time delimiter, use the Windows Control Panel.

A valid time string is in the format HH:MM:SS or HH:MM:SS tt, where HH is the hour in the range 0-23, MM is the minute in the range 0-59, SS is the second in the range 0-59 and tt is the time extension; for example,, am or pm. The colon character ':' represents the time delimiter for these fields, which will be the current system time delimiter as set in the Windows control panel.

Times may also be passed in the for HH or HH:MM. In other words, you may omit the right-hand fields if they are 0.




The string to convert.

Return Value

A time/date variable, or -1 if no conversion can be performed.

Related Functions

Time, Date


! Sets Variable to (11*3600+43*60+0) seconds.
! Sets Variable to (9*3600+2*60) seconds.
! Sets Variable to (2*3600) seconds.

See Also

String Functions