diff --git a/core/model/DataObject.php b/core/model/DataObject.php index 6299528de..400f7ef35 100755 --- a/core/model/DataObject.php +++ b/core/model/DataObject.php @@ -1013,9 +1013,9 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity // Add the class name to the base object if($idx == 0) { - $manipulation[$class]['fields']["LastEdited"] = SS_Datetime::now()->URLDate(); + $manipulation[$class]['fields']["LastEdited"] = "'".SS_Datetime::now()->Rfc2822()."'"; if($dbCommand == 'insert') { - $manipulation[$class]['fields']["Created"] = SS_Datetime::now()->URLDate(); + $manipulation[$class]['fields']["Created"] = "'".SS_Datetime::now()->Rfc2822()."'"; //echo "
  • $this->class - " .get_class($this); $manipulation[$class]['fields']["ClassName"] = "'$this->class'"; } @@ -1057,9 +1057,9 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity $this->flushCache(); if(!isset($this->record['Created'])) { - $this->record['Created'] = SS_Datetime::now()->URLDate(); + $this->record['Created'] = SS_Datetime::now()->Rfc2822(); } - $this->record['LastEdited'] = SS_Datetime::now()->URLDate(); + $this->record['LastEdited'] = SS_Datetime::now()->Rfc2822(); } // Write ComponentSets as necessary diff --git a/core/model/fieldtypes/Date.php b/core/model/fieldtypes/Date.php index 416dc6950..60a7a12cb 100644 --- a/core/model/fieldtypes/Date.php +++ b/core/model/fieldtypes/Date.php @@ -128,6 +128,10 @@ class Date extends DBField { if($this->value) return date('r', strtotime($this->value)); } + function Rfc2822() { + if($this->value) return date('Y-m-d g:i:s', strtotime($this->value)); + } + function Rfc3339() { $timestamp = ($this->value) ? strtotime($this->value) : false; if(!$timestamp) return false;