我使用
$collection = $db->mpres_seq ;
$document = array(
"id" => new MongoInt64(1),
"last_executed" => new MongoDate(strtotime("2012-04-01 04:00:00")),
"last_message" => ""
);
$collection->insert($document);此代码用于插入时间戳数据。现在我想把它拿回来。我想要mysql中相同类型(和格式)的Unix_Timestamp(last_executed)
。我该怎么做?
> db.mpres_seq.find().pretty()
{
"_id" : ObjectId("528a3a2af7bde99408000080"),
"id" : NumberLong(1),
"last_executed" : ISODate("2012-04-01T02:00:00Z"),
"last_message" : ""
}
这是一个示例结果。
您只需要使用mongodate。
为了显示人类可读的MongoDate,您可以使用这个:
<?php
date('Y-M-d h:i:s', $yourDate->sec);