note 119444 deleted from datetime.gettimestamp by cmb

From: Date: Sun, 05 Jan 2020 08:51:16 +0000
Subject: note 119444 deleted from datetime.gettimestamp by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213782@lists.php.net to get a copy of this message
Note Submitter: mindplay.dk ---- Miguel's comment is wrong - getTimeStamp() always returns a timestamp, this has nothing to do with timezones at all, as you can see below. What's really happening in Miguel's example, is he is parsing the input dates in different timezones. There is no such thing as "a timestamp relative to the timezone". <?php $d = new DateTime('2016-03-11 11:00:00', new DateTimeZone('Europe/Rome')); var_dump($d->getTimestamp()); // 1457690400 $d->setTimeZone(new DateTimeZone('America/New_York')); var_dump($d->getTimestamp()); // 1457690400

« previous php.notes (#213782) next »