I have a date with this format
Fri Feb 07 17:22:23 +0000 2014
How can calculate difference with server current time in php?
I try
date('D M d H:i:s Y');
date_diff
but no luck
I have a date with this format
Fri Feb 07 17:22:23 +0000 2014
How can calculate difference with server current time in php?
I try
date('D M d H:i:s Y');
date_diff
but no luck
Convert both times to UNIX time (i.e. times since the epoch).
You get the difference in seconds between the two.
Then just do the mathematics
first and second date time
$myd1 = strtotime('Fri Feb 07 17:22:23 +0000 2014');
$myd2 = strtotime('now');
difference
$d1 = $myd2 - $myd1;
hours minutes seconds as you asked
$hours = (int)($d1/3600);
$kalan= $d1 % 3600;
$minutes = (int)(($kalan) / 60);
$seconds = ($d1 % 60 ) ;