On Tue, February 20, 2007 8:25 am, Dave Goodchild wrote: > I am building an events directory and when users search, they provide > a date > range ie Feb 16 2007 to March 12 2007 as one of the options for > searching. > The system then creates an array of timestamps from this and then
Why would you create a range, which could potentially be quite a large set, instead of using the SQL "BETWEEN" operator, or even just using: WHERE whatdate >= '$start_date' AND whatdate <= '$end_date' It just seems to me like you are creating a giant JOIN for no real purpose, which is going to end up slogging your database as soon as you extend the date range out more than a few weeks... > polls the > database for all events whose lifetimes (start to end data) intersect > with > or contain the user date ranges. The system then checks how many of > those > dates map onto the dates provided by the user and returns an array of > events > on specific dates, all by comparing timestamps. > > The system is working like a dream apart from the following. If the > user > selects a start date prior to March 26 2007 or after October 29th 2007 > all > is well. If they specify a start date after March 26 the events are > not > being pulled in. > > I have converted the user-friendly date output to timestamps to check > and > sure enough, when the user selects a start date before March 26 2007, > March > 26 2007 is output as: > > 1174863600 > > ...after that it becomes: > > 1174860000 > > ...a difference of 3600 > > Is this anything to do with leap seconds or any other clock drift > phenomenon > anyone has seen before? Much hair being torn out at present! This probably is a daylight savings time issue... But if you don't care about the hour/minute/second, you probably should not be messing with Unix time-stamp in the first place... -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php