Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Time Difference (See related posts)

Get the difference between 2 times in PHP

$start = "09:00";
$finish = "10:30";
 
 
$tempstart=explode(":",$start);
$tempEnd=explode(":",$finish);
$tt=(($tempstart[0]*60)+$tempstart[1])+2400; 
$pp=(($tempEnd[0]*60)+$tempEnd[1]);
$difference=$tt-$pp;
$difference=$difference%2400;
$difftime=intval($difference/60).":".intval($difference%60);


You need to create an account or log in to post comments to this site.