Page 1 of 1

How to write regular expression for Time

Posted: 20 Dec 2013, 09:51
by shahzadzaveri
I need to add one customer field as From Time to To Time and want that user should input time only in the following format:
HH:MM:SS i.e. 18:20:30 and 18:30:30

How it can be done? and is it possible that in the next custom field, it automatically calculate the difference of From Time to To Time i.e. 10 Minutes.

Awaiting your reply.

Re: How to write regular expression for Time

Posted: 20 Dec 2013, 16:16
by dregad
We don't have "time" type custom fields. I suggest instead to use text field with a regular expression to validate the user's input, maybe something like (not tested)

Code: Select all

[0-2][0-9]:[0-5][0-9]:[0-5][0-9]
With regards to the calculation, I can't think of a way to easily do it out of the box. Maybe you can write a custom plugin.

Re: How to write regular expression for Time

Posted: 23 Dec 2013, 07:33
by shahzadzaveri
Thanks dregad ..... so nice of you ... it has resolved my issue ...