Log in

View Full Version : PHP / MYSQL Epoch Date Between



gpigate
03-11-2010, 11:14 PM
I am working on a project that involves an order table. This table has a DatePlaced column on it stored as an INT. This is populated using time() which is the epoch time in seconds from x etc.

I need to be able to select all orders where the DatePlaced between y and z. Y and Z will be form elements from html/php. What fomatting/conversion do I need to do to get mysql to understand what I am looking for?

This is super easy in oracle, I am hoping there is an easy solution in mysql

Thanks in advance

gpigate
03-12-2010, 01:47 AM
think I got it figured out.


$from = strtotime($_POST["datefrom"]);
$to = strtotime($_POST["dateto"]);
$parse.=" where DatePlaced BETWEEN ".$from." and ".$to." ";

I am actually building the parse query string based on different determinants being supplied by the user. It seems to be working though.