I’ve often found dates in PHP to be a bit of a pain to manage. A variety of similar functions in the language make it unnecessarily complicated to do what you need to do.

Getting the current date is one thing, but how about adding a set number of days to a date in the future? It’s possible, but not particularly intuitive. Here are a few tips to make life easier when dealing with dates in PHP.
Look At What You Want To Do
Breaking down the task at hand is always a good way to approach a problem. Do you need to get the current date? Are you doing any calculations or are you reformatting the date? It’s usually easier to do all the calculations first and worry about how the date is displayed last.
Write Unit Tests
Without unit tests, you’ll be copying around code that serves a specific purpose instead of writing small, testable methods that you can easily reuse. Unit testing is one way to make dates a lot easier to manage.
Allow A Date Override For Your Date Handling Methods
If you’re writing any code that handles dates, ensure you can pass in a specific date instead of relying on the current date.
For instance, I have a method that calculates the turnaround time for a print order, and it usually takes the current date and adds several days to it. (It has to skip weekends, which is why it’s not as simple as adding a set number of days.) This method is very easy to test because you can pass in a specific date with the number of turnaround days and verify the date that is returned.
Use Zend_Date
Zend_Date is the Zend Framework approach. This makes light work of handling dates in PHP.
Use a Date Picker
There’s a nice date picker in jQuery. This is more beneficial to help users when inputting dates, but it should reduce your workload too.
Photo by kevindooley