Hi,
I'm new to PHP and MySQL. I'm using the Symfony framework with Propel for my DB interaction. I have some timezone sensitive requirements I'm trying to figure out the best way to satisfy. Some
background:
In my app, certain users (consumers) create a reservation for a service, and the start and end time of the service is specified. This can be booked anywhere in North America, so the times specified by the user should be local to their local time.
Service providers can offer to provide the service to the consumer, and will specify a period within which they need to be notified (eg: 1 day before the start time of the reservation).
So in my app, I need to be able to determine things like the following:
1) If the consumer tries to book the service provider, is it within the service provider's notification period?
2) Determine reservations for which no provider has been selected, and which have passed their start time.
Both of these have to be done in context to the timezone in which the reservation was booked. Since the reservation is made at a facility, I was planning to store the timezone of the facility in the database.
I'm trying to figure out the best approach for this, and since I don't have a hosting company yet, I'd like to make sure my approach is easily adaptable to whatever server setup my hosting company has.
The two different approaches I'm considering:
1) Don't convert the start/end times, just store them as is in the database. Then lookup the timezone and figure out the current time in that timezone in order to perform the above calculations.
2) Always convert the start/end times from the local timezone to GMT and then store the times in the database in a consistent timezone. Then just perform the above calculations relative to GMT.
I'm trying to figure out if one approach would be easier than the other, or if there are any complications or side effects I should consider.
If there are also any code examples for this kind of application requirement, that would be much appreciated!
Thanks,
Steve