Welcome Guest, Not a member yet? Register   Sign In
Difference between datetime
#1

[eluser]nydeveloper[/eluser]
I have a datetime variable which I'm pulling from a table, and am trying to determine whether or not the difference between the current time and the value of this variable is greater than 48 hours.

The issue so far is I'm unable to get the current date/time in the appropriate format and assign it to a variable in order to perform this calculation.

Here is the output from the variable that I'm pulling from the existing table:
2012-08-12 23:54:00

Any help here is appreciated. Thanks.
#2

[eluser]NeoArc[/eluser]
Try:
Code:
$int_timestamp = strtotime($database_datetime);


Perhaps you should do the filtering in your SQL query.
Code:
SELECT a FROM my_table WHERE DATE_ADD(created_on, INTERVAL 2 DAY) > NOW()



#3

[eluser]nydeveloper[/eluser]
Quote:Perhaps you should do the filtering in your SQL query.

Code:
SELECT a FROM my_table WHERE DATE_ADD(created_on, INTERVAL 2 DAY) > NOW()

Great idea. This is perfect. Thank you!




Theme © iAndrew 2016 - Forum software by © MyBB