Can i compare 2 mongodates like below? In my testing it is working good. But mongodates are objects and will they work the same way in future as well?
$d1 = new MongoDate(1391671630);
$d2 = new MongoDate(1391671631);
echo ($d1 < $d2); //returns 1 which is correct.
//and i tried all other comparisons (>, ==, >=, <=). Everything works good.
You will need to use the
sec
property of theMongoDate
object: