News Feed
Jobs Feed
Sections




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

Websanova.com:
Timezones, the Right Way
December 14, 2012 @ 10:17:21

On the Websanova.com site there's a recent post about doing timezones the right way when working with them in PHP and storing them in your (MySQL) database.

Timezones are actually a very trivial concept but they seem to be overlooked and over complicated. [...] Rather than storing a timezone with each date it's better to just accept a standard time to store all your dates with, thus doing the conversion to that standard time before storing the value in the database. It doesn't really matter what time we store it as, but it's generally a good idea to just use UTC+00:00.

They talk a little about what the UTC timezone is for those that may not know and show how to set it as the default timezone for your PHP application (with date_default_timezone_set or updating your php.ini). They also include the MySQL configuration option to set its default timezone and and example SELECT statement for extracting the data back out.

0 comments voice your opinion now!
timezone mysql database utc datetime default


blog comments powered by Disqus

Similar Posts

Nick Halstead's Blog: How to make AuctionAd$ dynamic with PHP

DevShed: Custom Session Management Using PHP and MySQL

PHPClasses.org: Lately in PHP, Episode 31 - The Urge to Kill Older PHP Versions

HowToForge.com: The Ultimate Media Server - Apache+SSL , PHP, MySQL and Jinzora

PHPit.net: Book Review: Mastering phpMyAdmin for Effective MySQL Management


Community Events











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


performance opinion podcast component code series language framework hack package hhvm composer security unittest facebook release install symfony2 application introduction

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