View Full Version : How to make a search system for date

01-18-2008, 02:58 PM
I am beginner to PHP. I am making a reporting system for the orders placed by customers. I want that, i enter the date like 18/01/08 into the text box and show me the results by date. The main problem is that date is in 10 digit unix format. i can retrive the date by use date function like
$test = date( 'd/m/y', $title);

please tell me the code.

01-18-2008, 04:55 PM
If you're using a database you should be using a DATE field to begin with, as it will save you a lot of trouble like this.

$dateFromUserInput = '18/01/08';
list($day, $month, $year) = explode('/', $dateFromUserInput);
$start = mktime(0, 0, 0, $month, $day, $year);

// if you use a database
$end = $start + (60 * 60 * 24);
// SELECT * FROM `table` WHERE `timestamp` > $start AND `timestamp` < $end

01-18-2008, 06:23 PM

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum