I've built a resort booking system that includes a calendar date picker. The resort is located in the Philippines. When the calendar date picker is generated, each date references a UNIX timestamp.
If a user (requesting a room from anywhere within the Asia/Manila timezone) chooses a check-in date from the calendar of March 15 (for example) and a check-out date of March 19, everything works as spec'd.
However, if a user from the States chooses the same check-in and check-out date, the dates specified both on-screen (in a reservation status div) and in their request confirmation March 14 and March 18 respectively (one day behind).
I think that I know what the problem is: since the php date function requires that the date.timezone be set, each time a user is served a new page, the timezone I've specified (through a config file) is set to date.timezone = Asia/Manila (GMT +8). Since the states is "behind" the Philippines by 16 to 18 hours I'm assuming this is the problem.
IF THIS IS THE GLITCH that's causing the "one day behind" anomaly, is there a way to automatically reset the timezone specification to reflect the USERS current timezone?
If this isn't the problem, can someone give me some insight in how to track down and solve this issue?
Was trying to use getTimezoneOffset() to solve my problem but still no love. I have coded a work around that does display the correct date no matter what timezone the users system clock is set to however so, for now, all is well.