How to Validate 24-Hour Time Format in EspoCRM Using a Formula

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • IshitaRana
    Junior Member
    • Apr 2025
    • 18

    #1

    How to Validate 24-Hour Time Format in EspoCRM Using a Formula

    Hi,

    I have a Text field in EspoCRM called startTime, and I want to ensure that users enter the time in 24-hour HH:mm format (e.g., 09:30, 23:45).

    I’m looking for a formula that can validate this field and show an error if the input is not in the correct format.
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1729

    #2
    Use a regex expression. You can generate here: https://regex-generator.olafneumann....ue%27.&flags=i
    or on other sites called regex generator.
    Set this in the field configuration pattern field. I think,, when it is set it automatically throws an error and does not allow to save the record. If not automatically, you can create an API befor save formula.

    Comment

    • yuri
      EspoCRM product developer
      • Mar 2014
      • 9323

      #3
      I'd recommend to create a custom formula function for this. Then, to check the validity using PHP datetime functions.
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      Working...