dtqpw68806 2010-06-16 12:33
浏览 18
已采纳

如果当前时间超过30秒(从数据库)

How would I construct a statement like if current time ($time) is more than 30 seconds past time ($djs['currenttime'])? Would it be something like

if ($time => $djs['currenttime'])? I can't figure it out with the 30 seconds..:).

Thanks :).

  • 写回答

2条回答 默认 最新

  • dongzhang2150 2010-06-16 12:36
    关注

    The 30 seconds you are struggling with it's simply a +30 added on the conditional incrementing the value of $djs['currenttime'].

    You can use the time() function to get the actual time. I'm assuming that djs['currenttime'] is a value extracted from the database. Therefore the comparison would be the following:

    if(time() > $djs['currenttime'] + 30){
        //actions here;
    }
    

    time() returns the number of seconds since Jan 1st 1970 00:00:00 GMT so for this to work, the format of the $djs['currenttime'] variable should also be a unix timestamp. If not, you will need to convert one of them to the appropriate format first.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记