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

- supported UNIX timestamp in datetime column

This commit is contained in:
David Grudl
2008-11-25 20:33:52 +00:00
parent 4b7b7de87a
commit 9244a1b1b5
5 changed files with 5 additions and 5 deletions

View File

@@ -503,7 +503,7 @@ class DibiResult extends DibiObject implements IDataSource
case dibi::FIELD_DATE:
case dibi::FIELD_DATETIME:
$value = strtotime($value);
$value = is_numeric($value) ? (int) $value : strtotime($value);
return $format === NULL ? $value : date($format, $value);
case dibi::FIELD_BOOL:

View File

@@ -307,7 +307,7 @@ final class DibiTranslator extends DibiObject
case 'd': // date
case 't': // datetime
return $this->driver->escape(is_string($value) ? strtotime($value) : $value, $modifier);
return $this->driver->escape(is_numeric($value) ? (int) $value : strtotime($value), $modifier);
case 'by':
case 'n': // identifier name