News Feed
Sections




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

Pumka.net:
Why MySQL timestamp is 24 seconds different from PHP
October 26, 2010 @ 11:24:31

On the Pumka.net blog, Anton Oliink has an interesting problem where his timestamp on the PHP side of his application was different than the one on his MySQL backend's side - by 24 seconds, in fact.

You may find that timestamp value returned by MySQL UNIX_TIMESTAMP() function is 24 seconds grater than those returned by PHP functions and classes like strtotime(), mktime, DateTime::getTimestamp(), Zend_Date::getTimestamp().

As it turns out, the issue isn't' really an "issue" after all - it's caused by MySQL's compensation for leap seconds. He gives a few ways you can avoid it being an issue in your application, though: disable leap seconds, only convert to timestamps on the PHP side or just use the "unix_timestamp()" and "from_unixtime()" methods to work with the values.

1 comment voice your opinion now!
mysql timestamp second leapsecond


blog comments powered by Disqus

Similar Posts

PHPBuilder.com: My Automated PHP Scripts for Creating FTP Connections to a Remote Server

DevShed: Paginating Result Sets for a Search Engine Built with MySQL and PHP 5

Alex Netkachov's Blog: Installing Debian Web-server with Apache, PHP, and MySQL on virtual machine

Sematopia.com: How to - Backup MySQL database & email results using PHP

PHPBuilder.com: Import MS Access Data to MySQL 5


Community Events

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


release voicesoftheelephpant api opinion extension interview security version podcast framework community laravel5 unittest threedevsandamaybe library laravel series introduction language symfony

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