mirror of
https://github.com/dg/dibi.git
synced 2025-08-16 02:54:25 +02:00
Use DateTime instead of date()
On 32bits systems, date() is affected bug the 2038 bug DateTime always uses 64bits representation [Closes #110] Signed-off-by: Etienne CHAMPETIER <etienne.champetier@fiducial.net>
This commit is contained in:
committed by
David Grudl
parent
ddf7b74bf0
commit
7318658017
@@ -238,10 +238,11 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
||||
return $value ? 1 : 0;
|
||||
|
||||
case dibi::DATE:
|
||||
return $value instanceof DateTime ? $value->format($this->fmtDate) : date($this->fmtDate, $value);
|
||||
|
||||
case dibi::DATETIME:
|
||||
return $value instanceof DateTime ? $value->format($this->fmtDateTime) : date($this->fmtDateTime, $value);
|
||||
if (!$value instanceof DateTime) {
|
||||
$value = new DibiDateTime($value);
|
||||
}
|
||||
return $value->format($type === dibi::DATETIME ? $this->fmtDateTime : $this->fmtDate);
|
||||
|
||||
default:
|
||||
throw new InvalidArgumentException('Unsupported type.');
|
||||
|
Reference in New Issue
Block a user