PHP Checking if the current date is before or after a set date

前端 未结 10 643
无人共我
无人共我 2021-02-01 13:10

Im pulling a date from a database which is formatted like dd-mm-YYYY.

What I want to do is check the current date;

  • if the current date is before the date com
10条回答
  •  抹茶落季
    2021-02-01 13:45

    I wanted to set a specific date so have used this to do stuff before 2nd December 2013

    if(mktime(0,0,0,12,2,2013) > strtotime('now')) {
        // do stuff
    }
    

    The 0,0,0 is midnight, the 12 is the month, the 2 is the day and the 2013 is the year.

提交回复
热议问题