PHP Check if current time is before specified time

前端 未结 9 2219
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 01:51

I need to check in PHP if the current time is before 2pm that day.

I\'ve done this with strtotime on dates before, however this time it\'s with a time o

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-29 02:42

    Use time(), date() and strtotime() functions:

    if(time() > strtotime(date('Y-m-d').' 14:00') {
        //...
    }
    

提交回复
热议问题