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

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

报告相同问题?

悬赏问题

  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件
  • ¥15 不同系统编译兼容问题
  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
  • ¥30 数字电源对DSP芯片的具体要求
  • ¥20 antv g6 折线边如何变为钝角
  • ¥30 如何在Matlab或Python中 设置饼图的高度
  • ¥15 nginx中的CORS策略应该如何配置
  • ¥30 信号与系统实验:采样定理分析
  • ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao