Hope you can help guys.
I am writing a php script and need to compare two timestamps to see if the new one is more than 15 minutes later than the last. Hope that makes sense.
$accessed is a value from a timestamp field in my database.
So I want to compare $accessed, if it is 15 mins more than $lastaccessed then I do something. If it is not I do something else.
make sense? Feel free to ask any questions
timestamp comparison
Started by adzeds, Dec 16 2009 09:13 AM
3 replies to this topic
#1
Posted 16 December 2009 - 09:13 AM
|
|
|
#2
Posted 16 December 2009 - 10:24 AM
#3
Posted 17 December 2009 - 08:48 AM
Thanks.
Next problem is that I am trying to add 30 minutes to a datetime value taken from a database.
How can I do this? Here is my code:
Next problem is that I am trying to add 30 minutes to a datetime value taken from a database.
How can I do this? Here is my code:
$a=0;
while ($a < $num) {
$Query = "SELECT * from analytics WHERE ipaddress = '" . $ipaddress[$a] . "'";
$Result = mysql_query( $Query );
$num2 = mysql_num_rows($Result);
$b = 0;
while ($b < $num2) {
$accessed = mysql_result($Result,$b,"access_time");
if ($lastaccessed = '')
{
$lastaccessed = $accessed;
$visitcount++;
}
else {
$timeplus30 = ?;
if($accessed > $timeplus30)
{
$visitcount++;
} else
{}
}
$b++;
}
$a++;
}
Edited by WingedPanther, 17 December 2009 - 01:41 PM.
fix php tag
#4
Posted 17 December 2009 - 01:41 PM


Sign In
Create Account


Back to top









