PHP microtime to MySQL timestamp: Difference between revisions
Created page with "{{exclaim}} Lose the accuracy after conversion. Microtime ex: 1426299057.8639 will lost the numeric after point (.8639) after saved to {{kbd | key = TIMESTAMP}} type ex: 2015-..." |
m Text replacement - "== references ==" to "== References ==" Tags: Mobile edit Mobile web edit |
||
| (3 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
{{exclaim}} | {{exclaim}} Warning: It will lose the accuracy after conversion. Microtime ex: 1426299057.8639 will lost the numeric after point (.8639) after saved to {{kbd | key = TIMESTAMP}} type ex: 2015-03-14 10:10:57 (equals to 1426299057) | ||
1. Check the MySQL server's current time zone: {{kbd | key =<nowiki>show variables like '%time_zone%';</nowiki>}}<ref>[http://dev.mysql.com/doc/refman/5.7/en/time-zone-support.html MySQL :: MySQL 5.7 Reference Manual :: 10.6 MySQL Server Time Zone Support]</ref>. It's also the timezone which the data with {{kbd | key = TIMESTAMP}} type stored. example output: | 1. Check the MySQL server's current time zone: {{kbd | key =<nowiki>show variables like '%time_zone%';</nowiki>}}<ref>[http://dev.mysql.com/doc/refman/5.7/en/time-zone-support.html MySQL :: MySQL 5.7 Reference Manual :: 10.6 MySQL Server Time Zone Support]</ref>. It's also the timezone which the data with {{kbd | key = TIMESTAMP}} type stored. example output: | ||
| Line 24: | Line 24: | ||
//$timestamp: 2015-03-13 10:10:57 | //$timestamp: 2015-03-13 10:10:57 | ||
</pre> | </pre> | ||
== References == | |||
<references/> | |||
[[Category:PHP]] [[Category:Programming]] | [[Category:PHP]] [[Category:Programming]] | ||
[[Category:Web_Dev]] | [[Category:Web_Dev]] | ||
[[Category:Time river]] | |||