note 95609 added to datetime.settimestamp

From: Date: Tue, 12 Jan 2010 16:11:47 +0000
Subject: note 95609 added to datetime.settimestamp
Groups: php.notes 
Request: Send a blank email to php-notes+get-164879@lists.php.net to get a copy of this message
Here is a simple implementation for php 5.2. It simply calls the constructor again using the "@" notation that it accepts. <?php class MyDateTime extends DateTime { public function setTimestamp($timestamp = null) { $dateStr = ($timestamp == null ? null : "@$timestamp"); $this->__construct($dateStr, $this->getTimezone()); return $this; } } ?> ---- Server IP: 85.214.154.209 Probable Submitter: 173.14.230.129 ---- Manual Page -- http://www.php.net/manual/en/datetime.settimestamp.php Edit -- https://master.php.net/note/edit/95609 Del: integrated -- https://master.php.net/note/delete/95609/integrated Del: useless -- https://master.php.net/note/delete/95609/useless Del: bad code -- https://master.php.net/note/delete/95609/bad+code Del: spam -- https://master.php.net/note/delete/95609/spam Del: non-english -- https://master.php.net/note/delete/95609/non-english Del: in docs -- https://master.php.net/note/delete/95609/in+docs Del: other reasons-- https://master.php.net/note/delete/95609 Reject -- https://master.php.net/note/reject/95609 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164879) next »