Article View: pl.comp.lang.php
Article #232004Re: [cross] MySQL i timestamp
From: Arkadiusz Moch
Date: Mon, 28 May 2018 04:25
Date: Mon, 28 May 2018 04:25
32 lines
2387 bytes
2387 bytes
W dniu sobota, 26 maja 2018 14:25:31 UTC+2 użytkownik Roman Tyczka napisał: > 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ą? > > -- > pozdrawiam > Roman Tyczka Sprawdź php.ini: [...] [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = "Europe/Warsaw" [...]
Technical Details
Message-ID:
<a4f7f2c7-076f-44d7-adcc-7a3d5f0aa162@googlegroups.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!newsreader5.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!x25-v6no2514657qto.0!news-out.google.com!k3-v6ni923qtj.0!nntp.google.com!x25-v6no2514653qto.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mailReferences:
<136fubwhcunsl$.dlg@tyczka.com>Show Full Headers
Complete Article Headers
X-Received: by 2002:a37:1397:: with SMTP id 23-v6mr6641480qkt.25.1527481543254; Sun, 27 May 2018 21:25:43 -0700 (PDT) X-Received: by 2002:a37:124a:: with SMTP id c71-v6mr324055qkh.1.1527481543133; Sun, 27 May 2018 21:25:43 -0700 (PDT) Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!newsreader5.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!x25-v6no2514657qto.0!news-out.google.com!k3-v6ni923qtj.0!nntp.google.com!x25-v6no2514653qto.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: pl.comp.lang.php Date: Sun, 27 May 2018 21:25:42 -0700 (PDT) In-Reply-To: <136fubwhcunsl$.dlg@tyczka.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=185.122.172.22; posting-account=D-RL0AoAAACPBS3GiU10Ijqcw51gTn9e NNTP-Posting-Host: 185.122.172.22 References: <136fubwhcunsl$.dlg@tyczka.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <a4f7f2c7-076f-44d7-adcc-7a3d5f0aa162@googlegroups.com> Subject: Re: [cross] MySQL i timestamp From: Arkadiusz Moch <arkadiusz.moch@gmail.com> Injection-Date: Mon, 28 May 2018 04:25:43 +0000 X-Received-Bytes: 2345 X-Received-Body-CRC: 3189138818 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit