News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
How To Synchronize Your PHP and MySQL Timezones
April 20, 2011 @ 11:52:50

In a new post to the SitePoint PHP blog today Craig Buckler looks at a method for synchronizing your time between your PHP application and it's MySQL backend to make date handling a bit easier - no messy code-based timezone changes needed.

Many developers solve the problem by shifting all date/time responsibility to PHP. They may also convert dates to Unix timestamp integers for simpler handling, although you should be wary of the Y2K38 Bug.

They show a handy tip so you won't have to worry quite so much that relies on setting a "TIMEZONE" constant you can use to set the default timezone and a "time_zone" offset that can be used each time you make the connection to your database (or, alternatively, in a cron that keeps things up to date without interfering with performance).

0 comments voice your opinion now!
timezone sync mysql database offset


blog comments powered by Disqus

Similar Posts

Daniel Krook's Blog: Native XML Databases at NYPHP next week

GotoTech.com: Developer Diary: Taming Doctrine’s 2000 Flushes

Quoderat's Blog: Three simple tips for LAMP web site developers

Noupe.com: 13 Great WordPress Speed Tips & Tricks for MAX Performance

Paul Reinheimer: Using GeoIP at WonderProxy


Community Events





Don't see your event here?
Let us know!


bugfix interview list series framework tips language symfony zendserver laravel voicesoftheelephpant conference deployment release introduction threedevsandamaybe code podcast api community

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework