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

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

 



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

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux