toTime Method

Class: String

Description

This method converts a formatted time to an internal time (the number of seconds since midnight).

 

The method expects a time string in the format HH:MM:SS. It recognizes a 24-hour clock, and a 12-hour clock with "P" denoting PM and "A" denoting AM. Minutes and seconds can be omitted. They will assume a default of "00".

Syntax

StringObject.toTime()

Parameters

None.

 

Returns

A Time.

When Became Available

v7.0

Example

type String S1 = "12:34:56"

type Time   T1 = S1.toTime() // (45296)

 

set S1 = "12:34:56 P"        // "P" is sufficient

set T1 = S1.toTime()         // (45296)

 

set S1 = "12:34:56 PM"       // more complete

set T1 = S1.toTime()         // (45296)

 

set S1 = "12:34:56 AM"

set T1 = S1.toTime()         // (2096)

 

set S1 = "16:4"              // single digits are allowed

setT1 = S1.toTime() // (57840)