IS_TIME()

IS_TIME()

Prototype
IS_TIME(time, [format])

Verifies if a string has time format (hh:mm:ss) and is a valid time (for example 12:65:32 is not valid because 65 is not a valid minute)

Partial times are allowed depending on format value. See examples below.

The string provided can include a date part, which will be ignored unless it is an invalid date expression.

Input Parameters

Parameters

Type

Default

Required

Description

Parameters

Type

Default

Required

Description

time

String

 

Yes

Time to verify

format

String

"S"

No

Units in which VALUE is expressed. Accepted values are:

  • "S": require full time ("hh:mm:ss")

  • "M": require at least until minute part ("hh:mm" or "hh:mm:ss")

  • "H": require at least until hour part ("hh", "hh:mm" or "hh:mm:ss")

If no format is specified, then "S" is the default value

Return value

Type

Description

Type

Description

Boolean

  • 0: the time is invalid

  • 1: the time is valid

Execution

Always. Calculated on-the-fly whenever an ITEM of a FORM is changed (by means of form_set_answer(), or when the FORM is opened

Examples

Formula

Description

Formula

Description

IS_TIME("12:33:24")

No UNIT specified, so "S" is assumed. Result = 1

IS_TIME("12:65:22")

Invalid time because minute 65 is not possible. Result = 0

IS_TIME("12:33", "M")

Required time with at least minute part. Result = 1

IS_TIME("12:33:24", "M")

Required date with at least minute part. Result = 1

IS_TIME("2019-11-21 12:33:24")

Time expression includes a valid date part. Result = 1

IS_TIME("2019-34-21 12:33:24")

Time expression includes an invalid date part. Result = 0