You would think that with PHP and MYSQL having such a lovely relationship that using dates PHP in MYSQL (and vice versa) would be a little more intuitive.  I guess it is intuitive to those who speak UNIX.

So say you want to select a recordset between two dates.  Here’s how:

//start with a date 30 days ago
$startdate = mktime(0, 0, 0, date("m"), date("d")-30, date("y");

//end with a date umm... today
$enddate = date();

//should use sprintf() but here's the skinny
$query = 'SELECT * FROM myTable ';
$query .= 'WHERE that_date BETWEEN FROM_UNIXTIME(' . $startdate . ') ';
$query .= 'AND FROM_UNIXTIME(' . $enddate . ');';

$result = mysql_query($query);

From Unix Time. Of course.