subtracting time
Posted: Tue Feb 22, 2011 8:56 am
Hi,
I have one page that writes the time to a text file when called. I have a second page that reads this time and compares it to the current time. I need to subtract the two and have tried using strotime, but it does not work correctly. What am I doing wrong?
I have one page that writes the time to a text file when called. I have a second page that reads this time and compares it to the current time. I need to subtract the two and have tried using strotime, but it does not work correctly. What am I doing wrong?
Code: Select all
<?php
$myFile = "dates.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 24);
fclose($fh);
echo "$theData <br/><hr>";
$todays_date = date("g:i:s:a");
$today = strtotime($todays_date);
$exp_date = strtotime($theData);
echo "System status is ";
if ($today - $expiration_date > 30000) { $valid = "Up"; } else { $valid = "Down"; }
echo($valid);
?>