Last active
October 10, 2017 20:55
-
-
Save jacobbubu/5408997 to your computer and use it in GitHub Desktop.
Regular Expression for UTC time offsets validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
^([+]((14|(14[:]?00))|([0][0-9]|[1][01])|([0][0-9]|[1][01])[:]?[0-5][0-9]))|([-]((12|(12[:]?00))|([0][0-9]|[1][01])|([0][0-9]|[1][01])[:]?[0-5][0-9]))$ | |
The offset from UTC is given in the format ±[hh]:[mm], ±[hh][mm], or ±[hh], for exsamples: | |
Reference to http://en.wikipedia.org/wiki/Zone.tab. | |
+14:00 | |
+1200 | |
+12 | |
-11:59 | |
-01 | |
-0200 | |
-1200 | |
Invalidate string: | |
12 | |
12:59 | |
1300 |
kfalconer
commented
Oct 10, 2017
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment