ValidationRules for Time Format in Text Fields

There are various reasons why time needs to be managed in text fields.

A typical case is when you want to define only time in custom metadata types.

In such cases, the following input rules can be used to validate if the text field is entered in a time format.

To check if it is in the hh:mm:ss

REGEX(field_name, "^([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$")

To check if it is in the hh:mm

REGEX(field_name, "^([01][0-9]|2[0-3]):[0-5][0-9]$")