Jump to content

dates and some math


villain222

Recommended Posts

I'm trying to make a script to check a files date time and if its under so many seconds long the page will refresh.  here is what I've got.  I've been testing the output of the date() functions but when i do the math all i get is a 0.  where did i go wrong? is it just i can't do math with dates?  Thanks in advanced.

<html><head>
<meta http-Equiv="Cache-Control" Content="no-cache">
<meta http-Equiv="Pragma" Content="no-cache">
<meta http-Equiv="Expires" Content="0">
<? 
$proFile = "profilePics/profile.jpg";
//if ( date ("m d Y H:i:s.") - date ("m d Y H:i:s.", filemtime($proFile)) <= 00 00 0000 00:00:04 ){ //this is where the magic should happen.
//echo "<meta http-equiv="refresh" content='4'>"; }
?>
</head>
<?
echo date ("m d Y H:i:s.");
echo "<br>";
echo date ("m d Y H:i:s.", filemtime($proFile));
echo "<br>";
echo  date ("m d Y H:i:s.") - date ("m d Y H:i:s.", filemtime($proFile)); //only outputs 0

?>

Link to comment
https://forums.phpfreaks.com/topic/213540-dates-and-some-math/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.