I want my product, like every other web product out there, to pull a data information from my database and convert it to the user's timezone before displaying it on a page. I am using PHP and MySQL.
Is the use of TIMESTAMP fields more common than the use of DATETIME fields?
From my research, it seems that using DATETIME fields, I would have to
- Store all date information in UTC
- call
date_default_timezone_set('UTC')
each time the application starts - manually subtract the user's UTC offset hours from dates created using date() being based on the current date/time
- manually subtract the user's UTC offset hours from existing dates passed to and formatted by date()
Using TIMESTAMPS for my date fields, it seems I will only have to run the following when a database connection is made: SET time_zone='the users timezone' (eg. America/Los_Angelos).
Considering this, I would deduce most people would be inclined to using TIMESTAMPs rather than DATETIMEs...is this accurate?