0

I have this code and he calculate date diference and it's been good so far but I have problem, I want to subtract high number from lower and show value on negative and this code automatically find which number is higher I don't want that.

$to_time = strtotime("2012-10-25 10:42:00"); $from_time = strtotime("2012-10-26 10:21:00"); echo round(abs($to_time - $from_time) / 60,2). " minute"; 
0

2 Answers 2

1

Try

echo round(($to_time - $from_time) / 60,2). " minute"; 
Sign up to request clarification or add additional context in comments.

Comments

0

Try this

$to_time = strtotime("2012-10-25 10:42:00"); $from_time = strtotime("2012-10-26 10:21:00"); echo round(($to_time - $from_time)/60,2). " minute"; 

Comments