dongpan2788 2013-11-21 11:23
浏览 108
已采纳

Unix_Timestamp到mongo

there is a mysql query as follow,

SELECT Unix_Timestamp(last_executed)
    FROM mpres_seq

now i need to do same thing in php with MongoDB. In mongodb i have saved last_executed as ISO Date. How can i do that? if i used $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

  • 写回答

1条回答 默认 最新

  • doubu5154 2013-11-21 11:31
    关注

    You simply print out the secs of the MongoDate:

    foreach($res as $row){
        echo $doc['last_executed']->sec;
    }
    

    Reference:

    http://php.net/manual/en/class.mongodate.php

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Stata 面板数据模型选择
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用