Navigation Menu

Skip to content

Commit

Permalink
DibiResult: default type for datetime changed from timestamp -> objec…
Browse files Browse the repository at this point in the history
…t DateTime (BC break)
  • Loading branch information
dg committed Feb 24, 2010
1 parent c01bfd7 commit 92ea9f2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dibi/libs/DibiResult.php
Expand Up @@ -49,7 +49,7 @@ class DibiResult extends DibiObject implements IDataSource
private $rowClass = 'DibiRow';

/** @var string date-time format */
private $dateFormat = 'U';
private $dateFormat = '';



Expand Down Expand Up @@ -573,13 +573,13 @@ final public function convert($value, $type)
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 {
Expand Down

0 comments on commit 92ea9f2

Please sign in to comment.