Hello Reader's!
If you need to calculate the number of hours or days between two given dates then PHP offers you a lot of ways. But you can perform this task by the following way:
Lets see the example below:-
//Calculate number of hours between pass and now
$dayinpass = "2015-01-23 08:11:62";
$today = time();
$dayinpass= strtotime($dayinpass);
echo round(abs($today-$dayinpass)/60/60);
// here you will get the number of hours between given date and now.
Similarly you can get the days and even months also.
0 Comment(s)