Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

StrToTime

  • Last UpdatedFeb 02, 2024
  • 1 minute read

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.

Note: When you call the StrToTime function, it does not have any context of the day or date. This means it does not take into account daylight savings transitions. To accommodate days where a daylight savings time transition occurs, you need to use alternative Cicode functions that accept both date and time as arguments (such as StrToTimestamp or TimestampToTimeInt).

Syntax

StrToTime(String)

String:

The string to convert.

Return Value

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

Time, Date

Example

Variable=StrToTime("11:43:00");

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

Variable=StrToTime("9:02");

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

Variable=StrToTime("2");

! Sets Variable to (2*3600) seconds.

See Also

String Functions

Using the Caret Escape Sequence Character

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in