I need a regex for validating date and time with the following format: yyyy-mm-ddThh:mm:ss. T is just a symbol between date and time. Thanks for help
I need a regex for validating date and time with the following format: yyyy-mm-ddThh:mm:ss
Share
Fully-powered solution:
EDIT: I don’t trust
strtotime. For example: “The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 UTC to Tue, 19 Jan 2038 03:14:07 UTC.” (quoted fromstrtotimemanual page). What if I want to accept dates out of this range? To me,strtotimeis an unknown black-box. Don’t get me wrong: I do use it, eventually! But I wouldn’t for this case.