Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!

Pumka.net: Why MySQL timestamp is 24 seconds different from PHP

Pumka.net: Why MySQL timestamp is 24 seconds different from PHP

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.

Source: http://www.phpdeveloper.org/news/15336

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Posted Październik 28th, 2010 in WEB and PHP Development.

Leave a response: