iDimensionz
iDimensionz


Welcome, Guest!     Login
Don’t have an account?  Create one NOW!

New Date and Time Functions in PHP 5.3.0

While browsing through the PHP documentation, I came across some very useful new functions available in PHP 5.3.0 for working with dates and times.  One of my current projects requires working with a date range.  There are various ways to do this.  I was originally going to use MySQL’s DATE_DIFF() function to calculate the number days in the range but connecting to the database for this functionality was obviously not the best solution.  I browsed the PHP documentation and found a date_diff() function that is part of PHP 5.3.0.  This function is just an alias of the DateTime class’s diff() function and returns a DateInterval instance which can be used to format the result.  The DateTime class is part of the ext/date extension.  I’m looking forward to the stable 5.3.0 release to be able to take advantage of this functionality.

Leave a Reply

You must be logged in to post a comment.


;