Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-02 Thread ioannes
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

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-02 Thread ioannes
The answer seems to be DATE_ADD but I haven't got it to work yet...asking the MySQL people. I need to do this in a SQL query: (arrival+nights)='$thisdate' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-02 Thread Ed Lazor
Quoting ioannes [EMAIL PROTECTED]: The answer seems to be DATE_ADD but I haven't got it to work yet...asking the MySQL people. Check your version of MySQL... I think that's a newer function. -Ed This message was sent using

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-02 Thread ioannes
) '$thisdate'; INTERVAL means what it says, so from 1/1/04 add an interval of 1 gives 3/1/04, not 2/1/04. Hence my -1. John - Original Message - From: ioannes [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, September 02, 2004 7:42 PM Subject: Re: [PHP-DB] Dates - adding to unix 86400

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-01 Thread ioannes
When I run this code I get: 31 10 2004 31 10 2004 http://www.shortstay-london.com/testdates.php - Original Message - From: Craig Brothers [EMAIL PROTECTED] To: ioannes [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, September 01, 2004 2:00 PM Subject: Re: [PHP-DB] Dates - adding

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-01 Thread John Holmes
From: ioannes [EMAIL PROTECTED] When I run this code I get: 31 10 2004 31 10 2004 http://www.shortstay-london.com/testdates.php Try printing out the hours, minutes and seconds along with the date and you'll see the issue. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-01 Thread ioannes
[day after first day above], but this gives me 11pm on 31 Oct as above. ? - Original Message - From: John Holmes [EMAIL PROTECTED] To: ioannes [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, September 01, 2004 2:31 PM Subject: Re: [PHP-DB] Dates - adding to unix 86400 seconds

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-01 Thread John Holmes
From: ioannes [EMAIL PROTECTED] Sunday 31st of October 2004 12:00:00 AM unix: 1099177200 - first day Saturday 30th of October 2004 12:00:00 AM unix: 1099090800 - previous day Sunday 31st of October 2004 11:00:00 PM unix: 1099263600 - day after first day if I add 86400 to first - 1099177200 - I

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-01 Thread Craig Brothers
: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday From: ioannes [EMAIL PROTECTED] When I run this code I get: 31 10 2004 31 10 2004 http://www.shortstay-london.com/testdates.php Try printing out the hours, minutes and seconds along with the date and you'll see

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-01 Thread ioannes
Magnificent. - Original Message - From: John Holmes [EMAIL PROTECTED] To: ioannes [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, September 01, 2004 3:10 PM Subject: Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday From: ioannes [EMAIL PROTECTED] Sunday 31st

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-01 Thread John Holmes
From: Craig Brothers [EMAIL PROTECTED] I think your problem might be due to daylight savings time. 10/31/04 is the day that the clocks get set back 1 hour (at 2am). therefore we have 25 hours in the day on 10/31. not sure how to get around it though, or why my system accounts for it. You're just

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-01 Thread Simon Rees
Isn't this due to how your operating system handles the switch from daylight saving time to GMT (or local equivilent)? Or is this handled by PHP? That could account for different experiences. Of course if your locale doesn't switch from DST on this date you won't see the issue either... Using

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-01 Thread ioannes
Message - From: Simon Rees [EMAIL PROTECTED] To: ioannes [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, September 01, 2004 3:16 PM Subject: Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday Isn't this due to how your operating system handles the switch from daylight

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-01 Thread ioannes
Of course, it's because the whole of Summer is an hour out and this changes 31 Oct. I had it backwards. I'd still like to find out if there is a mysql equivalent of gmmktime for use in queries like: SELECT UNIX_TIMESTAMP(mydate) FROM MyTable WHERE UNIX_TIMESTAMP(mydate)='$thisdate'; and

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-01 Thread ioannes
I'd still like to find out if there is a mysql equivalent of gmmktime for use in queries like: SELECT UNIX_TIMESTAMP(mydate) FROM MyTable WHERE UNIX_TIMESTAMP(mydate)='$thisdate'; and $thisdate is a gm date. Otherwise I need to convert the GMT date back to Summer time just for the query. Is

Re: [PHP-DB] Dates - adding to unix 86400 seconds not equal nextday

2004-09-01 Thread ioannes
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