Thread: Resolved datetime difference caluculation for caluculatin SLA in time View Single Post
 11-05-2012, 01:45 PM PM User | #1 nani_nisha06 Regular Coder   Join Date: Oct 2012 Location: mother land --india Posts: 159 Thanks: 37 Thanked 2 Times in 2 Posts datetime difference caluculation for caluculatin SLA in time 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. 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 Last edited by nani_nisha06; 11-05-2012 at 02:54 PM..