We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

save date time in ODM

How can I create ISODate object in mongodb using ODM?


$object->dateCreated = "new ISODate()"; 
$object->save();

it saves plain text.. and I need that date object. Is there a way?

Thanks



10.7k
Accepted
answer
edited Dec '14

Found solution:


$object->dateCreated = new \MongoDate(time());
$object->save();