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

From: Date: Thu, 02 Sep 2004 03:20:31 +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-36011@lists.php.net to get a copy of this message
Final problem on this was adding a number of nights to an arrival date in a query: $query="SELECT field FROM Table WHERE (UNIX_TIMESTAMP(arrival)+nights*86400-86400+3600)>='$thisdate')"; When the arrival date is in Summer, adding a number of night requires adjusting for the hour [3600], because the UNIX_TIMESTAMP is DST whereas I had adjusted $thisdate to GMT to be free of time saving complications. When the arrival date is in Winter, I don't need to add the hour. I added a condition like: "&& arrival<'2004/10/31'..." to differentiate. I realise now that I have to think about what if the Winter arrival date plus the nights brings the total back to Summer. ..seeing as I did not know the mysql expression for GMT timestamps, which would be easier. Thanks to all. John

« previous php.db (#36011) next »