[英]Unix_Timestamp to mongo
there is a mysql query as follow, 有如下的mysql查询,
SELECT Unix_Timestamp(last_executed)
FROM mpres_seq
now i need to do same thing in php with MongoDB. 现在我需要用MongoDB在php中做同样的事情。 In mongodb i have saved last_executed as ISO Date.
在mongodb中,我将last_executing保存为ISO日期。 How can i do that?
我怎样才能做到这一点? if i used
$collection = $global["dbmongo"] -> mpres_seq; $res = $collection->find(),array("last_executed"=>1,"_id"=>0));
如果我使用
$collection = $global["dbmongo"] -> mpres_seq; $res = $collection->find(),array("last_executed"=>1,"_id"=>0));
$collection = $global["dbmongo"] -> mpres_seq; $res = $collection->find(),array("last_executed"=>1,"_id"=>0));
Is it work for me. 对我有用吗? I want to get last_executed, in same type and same pattern in mysql
我想在MySQL中以相同类型和相同模式获取last_execute
You simply print out the sec
s of the MongoDate
: 您只需打印出
sec
的第MongoDate
:
foreach($res as $row){
echo $doc['last_executed']->sec;
}
Reference: 参考:
http://php.net/manual/en/class.mongodate.php http://php.net/manual/zh/class.mongodate.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.