C3rd
PHP and MySQL TimeZone Synchronization
Posted: 5 Nov 2013, 3:00am - TuesdayWe all know the PHP and MySQL holds different timezone... what if we want both PHP and MySQL sync together by adjusting your PHP code only... Here's the solution:
<?php define('TIMEZONE', 'Australia/Brisbane'); @date_default_timezone_set(TIMEZONE); $dt = new DateTime(); // get time offset $offset = $dt->format("P"); // update mysql timezone mysql_query("SET time_zone='$offset';"); ?>Thanks to Craig Buckler... Reference: http://www.sitepoint.com/synchronize-php-mysql-timezone-configuration/
Search
Categories
Related Links
- Apache Web Server
- ASP Immigration Services Ltd.
- CentOS Linux
- Color Scheme Picker
- CSS Button Generator
- Deviant Art Account
- Don Tabaniag - GraphiCult
- Jerson Maglasang Weblog
- Joshua Manlunas
- Mark "mungkey" Vicente
- Matt Arnilo Baluyos
- MySQL
- Paul Labis
- PHP
- PrendStar
- Ridvan Baluyos
- Scott Davies
- SEO Fart XML-RPC Ping Tool
- Stripes Generator
- The Hero
- Ubuntu Linux
- Vim Carlo Nabora (DA)
- Wella Maria Hong
- What is my IP?
- Xavier University - Ateneo de Cagayan
- Zabyer Community