Title |
Test
Find
YYYYMMDDHHMMSS - common interface datetime format with or without time
|
Expression |
^[0-9]{4}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])($|(([01][0-9]|2[0-3])[0-5][0-9][0-5][0-9])$) |
Description |
This expression validate the YYYYMMDDHHMMSS datetime format but also only the date YYYYMMDD. It does not control month length or leap years. Made for a SAP retail sales tickets interface.
For XML pattern facet this would do:
([0-9]{4}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])(([01][0-9]|2[0-3])[0-5][0-9][0-5][0-9]))|([0-9]{4}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])) |
Matches |
20200707181818 | 20200707 | 20200231010000 | 20200931 | 00011231235959 | 00000101 |
Non-Matches |
20201232 | 20201301 | 20200028 | 20200500 | 20200707235978 | 20201231128533 | 20200327453030 |
Author |
Rating:
Juan Carlos Gutiérrez Deliot
|
Source |
me |
Your Rating |
|