Jump to content

Recommended Posts

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()?

Link to comment
https://forums.phpfreaks.com/topic/191909-working-with-dates/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/191909-working-with-dates/#findComment-1011522
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.