Re: Dates - adding to unix 86400 seconds not equal nextday

From: Date: Thu, 02 Sep 2004 17:49:15 +0000
Subject: Re: Dates - adding to unix 86400 seconds not equal nextday
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-36020@lists.php.net to get a copy of this message
Sorry to visit this once again, but this is a problem with bits the solution to which causes other problems. I need to do this in a SQL query: (arrival+nights)>='$thisdate' 'arrival' is a date field, and 'nights' is an integer, so the above makes no sense, being like 2004/12/31+7 which is probably 00/00/00. However, if I use UNIX_TIMESTAMP(arrival)+nights*86400 I get the Summer time errors noted previously - if arrival is before one of the cross over dates (30 Oct and ?) and the departure (arrival+nights) is after. Adding 86400*nights will give a time which is an hour incorrect and maybe the wrong date. So how do I do a SQL query where I add a number of days to a date and avoid DST errors? Is there a way of forcing SQL to use GMT and not DST? Do I have to extract all the values and do it in php? Thanks, John

« previous php.db (#36020) next »