dongyu1918 2011-04-30 02:47
浏览 36
已采纳

处理日期

Here's what I need to do:

  1. I want to insert a date into a datetime MySQL field 30 days from from the current date
  2. When I pull that specific record, I want to be able to check whether that date has passed yet or not (i.e. expiration date)
  • 写回答

4条回答 默认 最新

  • douqun1977 2011-04-30 02:54
    关注

    For your insert:

    $thirty_days_from_today = date('Y-m-d H:i:s', time() + 60*60*24*30);
    

    Checking expiration dates:

    if(strtotime($row['expiration_date']) < time()) {
        // expired
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?