I spent more time than I wanted to today learning how to subtract unix based timestamps. I was looking for nodes (Drupal) that are greater than 30 days old. After much reading on all the different mysql time and date functions, I finaly found the solution...

<?php
$nodetype
= 'blog';
$nodestatus = 1;

$sql = "SELECT * FROM {node_copy} WHERE type = '%s' AND status = %d AND (to_days(now()) - to_days(from_unixtime(created)) > 30)";

$result = db_query($sql, $nodetype, $nodestatus);

  while($data = db_fetch_object($result)) {
   
// do something
 
}
?>

Name
E-mail (Kept Private)
Your Website
CAPTCHA
Are you human?
Image CAPTCHA