StrToTime method converts the string S, to a Date value. The resulting value has only the time portion. To convert a string to a Date value having both the date and time portions, use the
The method is applied to the following object:
The method has the following parameter:
Specifies the string to be converted. The method recognizes the time if the string has the "hh:mm:ss" format. Leading zeros, as well as the seconds part can be omitted. Both the 24-hour and 12-hour formats are supported. To indicate that the string represents time in the 12-hour format, use "AM", "PM", "am" or "pm".
If the source string does not represent valid time,
StrToTime raises an exception.
The value of the Date type to which the specified string has been converted.
The code below demonstrates how you can convert strings to time types values.
def StringToTime(): Log.Message(aqConvert.StrToDateTime("03:12 PM")) Log.Message(aqConvert.StrToDateTime("10:56:35 AM")) # The routine produces the following output: # 3:12:00 PM # 10:56:35 AM