note 95609 deleted from datetime.settimestamp by danielc
| From: | danielc@php.net | Date: | Sat, 24 Apr 2010 20:47:29 +0000 |
| Subject: | note 95609 deleted from datetime.settimestamp by danielc | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168598@lists.php.net to get a copy of this message | ||
Note Submitter: kendsnyder at gmail dot com
----
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;
}
}
?>