brob Posted January 30, 2007 Share Posted January 30, 2007 Hi,I have a database that uses unix timestamps (which I can not change)I need to be able search these timestamps for tomorrows date. The timestamps include both date and time but I only wish to search for tomorrows date the time does not bother me.Does anyone have any advice on how to do this?Thanks Quote Link to comment Share on other sites More sharing options...
makeshift_theory Posted January 30, 2007 Share Posted January 30, 2007 It is possible to use the follow:[code]function compare_dates($now){$tom = strtotime("+1 day");if($now > $tom) return true;else return false;}[/code]In this function you will pass the $now as the unix timestamp from your db and then the function will return true if the $now date is tomorrows date and false otherwise. Quote Link to comment Share on other sites More sharing options...
brob Posted January 30, 2007 Author Share Posted January 30, 2007 Hi sorry this wont work as the time stamp for today with both date and time included i.e. 30/01/2007 00:00is differnet from the date with a time included30/01/2007 16:00so I wouldn't be able to match these.Is there someway to match just the date and exclude the time in the match?Thanks Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 30, 2007 Share Posted January 30, 2007 Format the timestamp with just "Y-m-d" then use "WHERE datefield LIKE '$tomorrow%'" Quote Link to comment Share on other sites More sharing options...
makeshift_theory Posted January 30, 2007 Share Posted January 30, 2007 Yes, do like Jesirose said, that's just me trying to make things more complicated then they are. Quote Link to comment 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.