I have this urgent question about date in php. I want to query the database for certain records before a certain date, say I want records within 30 days, so first thing is I get current date, and I want to calculate the other end of the date range, how can I do that? Do I need to do this in mysql query or in php? Much appreciated!
Share
You can easily do that in mysql.
eg.
now() or CURRENT_TIMESTAMP -> will give you a value of current date.
date_sub, anddate_addare functions used to add or subtract intervalfrom given date.
Documentation here :
http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-add