Skip to content

Commit 56d4950

Browse files
committed
created_at as int
1 parent b66df25 commit 56d4950

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Model.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ public function toArray($fields = null, $datetime_format = \DateTime::ISO8601) {
480480

481481
// format dates if specified
482482
if ($datetime_format && ($type === DB::TYPE_DATETIME || in_array($field, ['created_at', 'updated_at', 'deleted_at']))) {
483-
$value = date($datetime_format, strtotime($value));
483+
$value = date($datetime_format, is_int($value) ? $value : strtotime($value));
484484
}
485485

486486
$result[$field] = $value;

0 commit comments

Comments
 (0)