nani_nisha06
11-05-2012, 12:45 PM
HI All,
As subject line says,
from the below I could successfully calculate days in to hours, time but I am able to calculate getting in to Minutes using below code.
//to claculate SLA
$datetime1=$date1; //first date
$datetime2=$date2; //second date
define("SECONDS_PER_HOUR", 24*60*60);
// Calculate timestamp
$start = strtotime($datetime1);
$stop = strtotime($datetime2);
// Diferences
$difference = $stop - $start;
// Hours
$hours = round($difference / SECONDS_PER_HOUR, 0, PHP_ROUND_HALF_DOWN);
$hourmul=($hours*24);
// Minutes
$minutes = ($difference/ SECONDS_PER_HOUR);
$minmul= round(($minutes/60));
// Seconds
$seconds = ($difference % SECONDS_PER_HOUR) / 60;
$secmul= round(($seconds/60));
$var= $hourmul. ":" .$minmul. ":" .$secmul;
please help to complete this function my desire output should be, for example.
Start date = 05-11-2012 23:15:00
end date= 06-11-2012 01:15:00
output should be 2:00:00 of time.
can any one help me ???
Regards,
nani
As subject line says,
from the below I could successfully calculate days in to hours, time but I am able to calculate getting in to Minutes using below code.
//to claculate SLA
$datetime1=$date1; //first date
$datetime2=$date2; //second date
define("SECONDS_PER_HOUR", 24*60*60);
// Calculate timestamp
$start = strtotime($datetime1);
$stop = strtotime($datetime2);
// Diferences
$difference = $stop - $start;
// Hours
$hours = round($difference / SECONDS_PER_HOUR, 0, PHP_ROUND_HALF_DOWN);
$hourmul=($hours*24);
// Minutes
$minutes = ($difference/ SECONDS_PER_HOUR);
$minmul= round(($minutes/60));
// Seconds
$seconds = ($difference % SECONDS_PER_HOUR) / 60;
$secmul= round(($seconds/60));
$var= $hourmul. ":" .$minmul. ":" .$secmul;
please help to complete this function my desire output should be, for example.
Start date = 05-11-2012 23:15:00
end date= 06-11-2012 01:15:00
output should be 2:00:00 of time.
can any one help me ???
Regards,
nani