I have a PHP Class file (salat.times.php) that accepts a few User Inputs, one of which is a Date in the format dd-mm-yyyy. The date is used for a part of the class and is fine.
In another part of the class, there are a number of Time outputs with the format hh:mm.
Now, there two of these dates that I cannot seem to get precisely how I would like.
Time 1 is 05:17
Time 2 is 07:08
What I am trying to do is to have Time 1 equal to Time 2 minus 90 minutes, and obviously still be in the same hh:mm format. In the above example, Time 1 would become 05:38.
I have been experimenting with PHP Timestamps, but I'm finding it difficult converting things backwards and forwards.
For example if I create a timestamp manually, like
$timestamp = strtotime('06-10-2010 07:08:00');
I get a timestamp of 1286348880. And if I subtract 5400 (90 minutes worth of seconds), I end up with a timestamp of 1286343480.
But with this I am having two problems.
1. How can I get a Date variable into the strtotime() part?
2. How can I get the converted timestamp back into the time format hh:mm?
As usual, some really expert advice will be hugely appreciated.