PHP Date Difference calculation using mktime functionWe will take the two dates with hour, minutes and seconds. If the hour minute and second is not important then we can keep the values as 0. Once both the time stamps are calculated then the difference in seconds are fund out by subtracting the two. For other differences we have to divide the difference in second in different values and taking the floor math value of it. date difference using date object 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 Here is the code to do that.
mktime() : create the timestamp using date and time Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
![]() | ||||||||||||||||
| ||||||||||||||||