Kryptix Posted February 12, 2010 Share Posted February 12, 2010 Hi chaps, I have a table with a column called 'time' which is PHP's TIME() or MySQL's UNIX_TIMESTAMP(), I need to allow a user to search between two certain times. They should be able to specify the start time and the end time and it will show all results before then. The 'time' column is obviously a INT (10), what query would I use? Something like this, or is there something more specific? SELECT * FROM `table` WHERE `time` > '" . $start . "' AND `time` < '" . $end . "' Also, does anyone know of a script or whatever where you can select a date from a pop-up window or something? What's the function to turn 01/12/2009 into a TIME()? Quote Link to comment https://forums.phpfreaks.com/topic/191909-working-with-dates/ Share on other sites More sharing options...
mikesta707 Posted February 12, 2010 Share Posted February 12, 2010 strtotime() $date = "01/12/2009"; $time = strtotime($date); thats how you can convert dates of most any format into a unix timestamp. as far as the query, yeah it looks fine. I'm not sure what you mean by Also, does anyone know of a script or whatever where you can select a date from a pop-up window or something? care to clarify? Quote Link to comment https://forums.phpfreaks.com/topic/191909-working-with-dates/#findComment-1011522 Share on other sites More sharing options...
mapleleaf Posted February 12, 2010 Share Posted February 12, 2010 http://jqueryui.com/demos/datepicker/ Quote Link to comment https://forums.phpfreaks.com/topic/191909-working-with-dates/#findComment-1011527 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.