I am converting an ASP application to PHP and have difficulty deciphering date check functionality.
In ASP, I have an isDate () function that allows me to check the date regardless of its format. Therefore, if someone enters any of the following values, isDate () returns true:
1/1/2012 January 1, 2012 Jan 12, 2010 1:00 pm 1/1/2012 1:32 pm
The advantage is that I can let the user enter data and time in whatever format they choose. After that, with minimal effort, I can update the database without doing any further processing (provided that true is returned). For instance:
UPDATE my_table SET date_field = @date_var WHERE my_id = @id_var [note: SQL Server 2008]
With PHP, I find that checking date / time is more complicated. Ive looked at the various questions posted here, as well as the documentation, and there seems to be no easy way to easily confirm a date, time, or a combination of date and time.
I am wondering if there are classes available to work with grunts. Something that will work as isDate () and send me true / false based on the date / time / date and time entered by the user.
Thanks.
source share