Time

Description

Converts a string to a time datatype.

Syntax

Time ( string )

Argument

Description

string

A string containing a valid time (such as 8 am or 10:25) that you want returned as a time datatype. Only the hour is required; you do not have to include the minutes, seconds, or microseconds of the time or am or pm. The default value for minutes and seconds is 00 and for microseconds is 000000. am or pm is determined automatically.


Return value

Time. Returns the time in string as a time datatype. If string does not contain a valid time, Time returns 00:00:00.

Examples

This expression returns the time datatype for 45 seconds before midnight (23:59:15):

Time("23:59:15")

This expression for a computed field returns the value in the time_received column as a value of type time if time_received is not the empty string. Otherwise, it returns 00:00:00:

If(time_received = "" ,00:00:00, 
Time(time_received))

This example is similar to the previous one, except that it returns 00:00:00 if time_received contains a null value:

If(IsNull(time_received), 00:00:00, 
Time(time_received))