![]() |
How to find difference between dates?
What is the correct way of finding difference between two dates in YYYY-MM-DD format?
|
I think that the easiest way is to convert the date strings into the integer Unix Timestamp (seconds since 1-1-1970 00:00) using
strtotime, subtract one from t'other and there's your difference between the two dates, in seconds.PHP Code:
If you are getting the date strings from MySQL, then there are some schmexy functions which you can plug directly into the query itself to return date differences. |
Thanks again Salathe.
Woo, two new functions under my inventory. |
| All times are GMT. The time now is 09:59 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0