hey yall need a little help figuring this out. in my database i have a column containing dates saved in this format 2010-05-17 19:31:41 What i would like to do is select all dates that are, lets say 2 days old to the current date. (eg. 2010-05-17 19:31:41 would be 2010-03-17 19:31:41) how can i do this thanks
To get a date in the past, you would use PHP's mktime function. Something like this would likely work: $time_in_past = mktime(0, 0, 0, date("m"), date("d") - 13, date("Y")); PHP: The above will create the corresponding Unix timestamp of 14 days ago. -Bing
No problem, we use this in one of our code examples for our API: http://docs.inclick.net/index.php/API_Example_Admin_Daily_Performance_Report Good luck!
You can do it inside your SQL statement; select * from your_table where datefield > (now() - INTERVAL 2 day) Code (markup): No need to mess around with PHP - if you require a different interval, minutes, weeks, seconds, whatever, just change the part after the interval after the line above.