doutang7414 2011-08-29 13:55 采纳率: 0%
浏览 31
已采纳

如果声明使用日期

Right now im using this if statement, but i need to modify it so that it shows include if they signed up AFTER today's date, instead of being equal to

    <?php
    if ($userinfo['signed_up']=="2011-08-29 09:00:00")
      include("launchbuilder_gorilla.php");
    else
      include("launchbuilder.php");
    ?>
  • 写回答

3条回答 默认 最新

  • dongli8862 2011-08-29 13:58
    关注
    if ($userinfo['signed_up'] > "2011-08-29 09:00:00")
    

    Should work, according to PHP's in-built type-casting, and that date format. If you need to transfer the current time to that format, use:

    if ($userinfo['signed_up'] > date("Y-m-d H:i:s"))
    

    However, as deceze pointed out, that doesn't make a whole lot of sense, so you might want something like:

    if ($userinfo['signed_up'] >= date("Y-m-d 00:00:00"))
    

    To check if they signed up at any point 'today'. See the date() function for more info.

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

报告相同问题?

悬赏问题

  • ¥15 Fluent udf 编写问题
  • ¥15 求合并两个字节流VB6代码
  • ¥15 Pyqt 如何正确的关掉Qthread,并且释放其中的锁?
  • ¥30 网站服务器通过node.js部署了一个项目!前端访问失败
  • ¥15 WPS访问权限不足怎么解决
  • ¥15 java幂等控制问题
  • ¥15 海湾GST-DJ-N500
  • ¥15 氧化掩蔽层与注入条件关系
  • ¥15 Django DRF 如何反序列化得到Python对象类型数据
  • ¥15 多数据源与Hystrix的冲突