mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Made date fixes for MSSQLDatabase more robust in DataObject::__construct()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79375 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c5ef811b94
commit
5affa62e6c
@ -265,13 +265,13 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
// MSSQLDatabase::date() uses datetime for the data type for "Date" and "SSDatetime"
|
// MSSQLDatabase::date() uses datetime for the data type for "Date" and "SSDatetime"
|
||||||
switch($this->db($k)) {
|
switch($this->db($k)) {
|
||||||
case "Date":
|
case "Date":
|
||||||
$v = preg_replace('/([ap]m)$/i', ' \\1', $v);
|
$v = preg_replace('/:[0-9][0-9][0-9]([ap]m)$/i', ' \\1', $v);
|
||||||
$record[$k] = date('Y-m-d', strtotime($v));
|
$record[$k] = date('Y-m-d', strtotime($v));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Datetime":
|
case "Datetime":
|
||||||
case "SSDatetime":
|
case "SSDatetime":
|
||||||
$v = preg_replace('/([ap]m)$/i', ' \\1', $v);
|
$v = preg_replace('/:[0-9][0-9][0-9]([ap]m)$/i', ' \\1', $v);
|
||||||
$record[$k] = date('Y-m-d H:i:s', strtotime($v));
|
$record[$k] = date('Y-m-d H:i:s', strtotime($v));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user