Re: Problems processing UNIX timestamps in events directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dave Goodchild wrote:
> Hi all. I have an odd problem.
> 
> 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 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

not directly related to your problem but sounds like your doing the search the
hard way .... there should be no need to create an array of timestamps ...

SELECT * FROM foo WHERE (startdate BETWEEN ? AND ?) OR enddate BETWEEN (? AND ?)

http://dev.mysql.com/doc/refman/4.1/en/comparison-operators.html

> 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!
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux