Validating date in php

It does not check for leap years or invalid dates at the end of short months.As we've seen before, creating re-usable functions can significantly reduce the size of your Java Script code.

You can find the details in Web Services using XMLHttp Request (Ajax) and related articles. It doesn't allow a space after minutes and before the am/pm example: " am" will get an invalid time. I modified the reg to the following: re = /^(\d): (\d)(:00)?

PHP date validation FAQ: How do I validate a date in PHP?

This is a little bit of a tough question because you'll probably want more than the basic PHP date validation technique.

As mentioned, you'll probably want to add additional date validation checks to your algorithm, but this is the basic check to validate a date in PHP.

PHP Date Time class, available with PHP versions greater than 5.2 is very powerful.

Leave a Reply