I am trying to "convert" a unix timestamp into a nicer to read date. I know this is easy but there is slightly more to it:
I have taken a time in the future which has been written into the database (MySQL) and set it as the variable $dbtime. I also have the variable $time which is equal to time(). I then want to find the difference between the two and then show it as a time. For example:
$time = time(); ##This is the current time as a unixts
$dbtime = $row['futuretime']; ##This is the time in the future written beforehand
$timeleft = $dbtime - $time; ##This is the difference between the two, the value I want to convert!
I assumed it would be:
$timeleftconvert = date('H:i:s', $timeleft);
However if the $timeleft is 2minutes for example the time will be echoed as "19:02:00" if it was 3 minutes it would be "19:03:00" etc...The code then does certain functions when the 2/3 minutes are up. If the time left is shown as 19:02:00 then after 2 minutes it will go on to complete the functions. IT WILL NOT TAKE 19 HOURS. I realised it would be possible to leave the hours out and then I would look fine however some of the future times are 24hrs however it still says 19hrs when converted...if this problem doesn't make sense and it wouldn't normally be a problem then maybe it is an error with the insertion of the future time into the database...