So it seems that PHP ActiveRecord is formatting the update timestamp (for me anyway)
When I print the updated date, it displays:
Wed, 05 Jun 2013 21:14:48 +0200
Where as in the DB I've got:
2013-06-23 20:04:18
Just to be a 100% certain I used PDO to retrieve the record it displayed exactly the format I see in the DB.
Any idea why this automatic formatting might happen? and if there is a way to correct it?
Thanks.
EDIT
Ok, so I discovered how to manipulate it:
$records->updated->format('Y-m-d');
However, I'd still like to know why it happens and if there is a way to set it by default.
phpactiverecord retrieves it and stores it in an object that extends
DateTime
.Normally you could do
->format($yourformat)
for anyDateTime
object, but for thephpactiverecord
child you get a default format that gets used if you do not supply one.This extension also has a
toString()
function that calls thisformat()
, so you get the default format (which you can set in this same class by the way).Take a look at the
DateTime.php
class provided by PHPActiveRecord to find out more, but this is what happens: