1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-01 11:50:15 +02:00

DibiDateTime: added __toString(), modify(), modifyClone()

This commit is contained in:
David Grudl
2012-01-12 14:59:56 +01:00
parent 8c481bc128
commit a8f5e09b69

View File

@@ -34,6 +34,22 @@ class DibiDateTime extends DateTime
public function modifyClone($modify = '')
{
$dolly = clone($this);
return $modify ? $dolly->modify($modify) : $dolly;
}
public function modify($modify)
{
parent::modify($modify);
return $this;
}
public function __sleep()
{
$this->fix = array($this->format('Y-m-d H:i:s'), $this->getTimezone()->getName());
@@ -62,4 +78,11 @@ class DibiDateTime extends DateTime
return $this->__construct(date('Y-m-d H:i:s', $timestamp), new DateTimeZone($this->getTimezone()->getName())); // getTimeZone() crashes in PHP 5.2.6
}
public function __toString()
{
return $this->format('Y-m-d H:i:s');
}
}