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

前端 未结 10 642
无人共我
无人共我 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 14:03

    a MySQL-only solution would be something like this:

    SELECT IF (UNIX_TIMESTAMP(`field`) > UNIX_TIMESTAMP(), `field`,'GO AHEAD') as `yourdate`
    FROM `table`
    

提交回复
热议问题