To get the difference in minutes we have to divide by 60
To get the difference in hours we have to divide by 3600 ( 60 minute x 60 seconds )
To get the difference tin days we have to divide by 86400 ( 24 x 60 x 60 )
To get the difference in months we have to divide by 2628000
In PHP to calculate the difference in two dates we have to use mktime function and then find out the difference in seconds. Then this difference in seconds is to be converted in to required month, days or year differences. We will try to learn a general way of identification and then format it accordingly.
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com
Sashi
20-03-2010
Thanks for providing this simple and efficient date difference check functionality. It works !
Sadart Abukari
09-07-2011
Great article for all my data manipulation needs. Implemented it with sessions using explode() to turn time stored in session as string and passed it to call_user_func_array with mktime and the exploded array as parameters. Thanks a bunch.
sriram
25-07-2014
nice code
Riddhish
09-04-2015
Really Helpfull
✖
We use cookies to improve your browsing experience. . Learn more