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

StrToPeriod

Converts a string into a time period. You would normally use this function to convert operator input, for example, to set a trend period.

A valid period string is in the format HH:MM:SS, MM:SS or SS, where HH is the hours, MM is the minutes and SS is the seconds. 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.

If minutes are specified, seconds need to be in the range 0-59. If hours are specified, minutes need to be in the range 0-59.

Syntax

StrToPeriod(String)

String:

The string to convert.

Return Value

A period (converted from String), or -1 if no conversion can be performed.

Related Functions

StrToTime, StrToDate

Example

Variable=StrToPeriod("200");
! Sets Variable to 200 (seconds).
Variable=StrToPeriod("200:40");
! Sets Variable to 12040 (12000 + 40 seconds).
Variable=StrToPeriod("48:00:40");
! Sets Variable to 172840 (172800 + 40 seconds).

See Also

String Functions