|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to find the Date difference in PHP?
Any Help link? |
|
#2
|
|||
|
|||
|
function date_diff($earlierDate, $laterDate) {
//returns an array of numeric values representing days, hours, minutes & seconds respectively $ret=array('days'=>0,'hours'=>0,'minutes'=>0,'seconds'=>0); $totalsec = strtotime($laterDate) - strtotime($earlierDate); if ($totalsec >= 86400) { $ret['days'] = floor($totalsec/86400); $totalsec = $totalsec % 86400; } if ($totalsec >= 3600) { $ret['hours'] = floor($totalsec/3600); $totalsec = $totalsec % 3600; } if ($totalsec >= 60) { $ret['minutes'] = floor($totalsec/60); } $ret['seconds'] = $totalsec % 60; return $ret; } |
![]() |
| Viewing: SEO Chat Forums > Other > SEO Scripts > Date diff in php |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|