From 92ea9f2c5ae04ff8fced1bb860439024a0861e44 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 24 Feb 2010 06:49:05 +0100 Subject: [PATCH] DibiResult: default type for datetime changed from timestamp -> object DateTime (BC break) --- dibi/libs/DibiResult.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dibi/libs/DibiResult.php b/dibi/libs/DibiResult.php index d14a2e22..9b152dd2 100644 --- a/dibi/libs/DibiResult.php +++ b/dibi/libs/DibiResult.php @@ -49,7 +49,7 @@ class DibiResult extends DibiObject implements IDataSource private $rowClass = 'DibiRow'; /** @var string date-time format */ - private $dateFormat = 'U'; + private $dateFormat = ''; @@ -573,13 +573,13 @@ class DibiResult extends DibiObject implements IDataSource if ((int) $value === 0) { // '', NULL, FALSE, '0000-00-00', ... return NULL; - } elseif ($this->dateFormat === 'U') { // return timestamp (default) - return is_numeric($value) ? (int) $value : strtotime($value); - - } elseif ($this->dateFormat === '') { // return DateTime object + } elseif ($this->dateFormat === '') { // return DateTime object (default) return new DateTime53(is_numeric($value) ? date('Y-m-d H:i:s', $value) : $value); - } elseif (is_numeric($value)) { // single timestamp + } elseif ($this->dateFormat === 'U') { // return timestamp + return is_numeric($value) ? (int) $value : strtotime($value); + + } elseif (is_numeric($value)) { // formatted date return date($this->dateFormat, $value); } else {