Archive for the ‘MySQL’ category

Tips for Manipulating dates in MySQL.

February 6th, 2009

Bypassing PHP to manipulate dates.

I despise working with dates in PHP. So much so that I now manipulate my dates using MySQL so I have everything I want in a php variable delivered by one SQL statement. Adding, subtracting, calculating differences and performing other date manipulations can be a pain in PHP. If you have a database connection running in your application it can be much quicker and easier to read if you work with dates in your SQL. The key to this is that you don’t need to work with tables and records in a database to use SQL. Many of the examples below don’t make queries against any record sets and yet they return valid results. » Read more: Tips for Manipulating dates in MySQL.