🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.bazy-danych
Article #195593

Re: [cross] MySQL i timestamp

#195593
From: Lemat
Date: Sat, 26 May 2018 22:19
26 lines
1937 bytes
W dniu 26.05.2018 o 14:25, Roman Tyczka pisze:
> Witam,
> 
> Mam w tabeli kolumnę typu Timestamp. Edytorem (DBWorkbench) widzę, że
> przedstawia ona wartość:
> 
> 26.05.2018 14:16:24
> 
> To prawidłowa wartość, bo pochodzi z chwili inserta (default
> current_timestamp).
> Teraz chcę odczytać wartość tego timestampa jako unix timestamp czyli int.
> Z poziomu PHP za pomocą PDO otrzymuję wartość: 1527336984
> Jednak ta liczba (wg. http://unixtimstamp.com) reprezentuje:
> 
> 26.05.2018 12:16:24
> 
> Czyli przesunięte o 2h wstecz, zatem pewnie czas UTC.
> Skąd to się bierze? I jak to poprawnie odczytać, żeby mieć tę wartość unix
> timestampa poprawną?
> 

https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html

-- 
Pozdrawiam
Lemat
Technical Details
Message-ID: <5b09dd8e$0$683$65785112@news.neostrada.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!feeder.erje.net!2.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!85.12.16.69.MISMATCH!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.fr7!futter-mich.highwinds-media.com!news.highwinds-media.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-a-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
References: <136fubwhcunsl$.dlg@tyczka.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!feeder.erje.net!2.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!85.12.16.69.MISMATCH!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.fr7!futter-mich.highwinds-media.com!news.highwinds-media.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-a-01.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
Subject: Re: [cross] MySQL i timestamp
Newsgroups: pl.comp.bazy-danych
References: <136fubwhcunsl$.dlg@tyczka.com>
From: Lemat <#@lemat.priv.pl>
Date: Sun, 27 May 2018 00:19:58 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0
MIME-Version: 1.0
In-Reply-To: <136fubwhcunsl$.dlg@tyczka.com>
Lines: 26
Message-ID: <5b09dd8e$0$683$65785112@news.neostrada.pl>
Organization: Telekomunikacja Polska
NNTP-Posting-Host: 83.12.155.201
X-Trace: 1527373198 unt-rea-a-01.news.neostrada.pl 683 83.12.155.201:38766
X-Complaints-To: abuse@news.neostrada.pl
X-Received-Bytes: 1644
X-Received-Body-CRC: 3707313253
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit