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:
@@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user