The last line would have to be translated to
echo '<h3>' . $reqDate->format('U') . '</h3>';
in order to work with PHP 5.2. Other that that, it looks fine.
Edit:
You could subclass DateTime
to provide a forwards compatible solution:
class MyDateTime extends DateTime {
public function getTimestamp() {
return method_exists('DateTime', 'getTimestamp') ?
parent::getTimestamp() : $this->format('U');
}
}
Øystein Riiser Gundersen
2009-09-02 18:04:17