dongzhaiqiang6108
dongzhaiqiang6108
2010-02-24 22:21

使用PHP检查时间是否超过晚上9点

  • date
  • datetime
  • php

What I am trying to do is I have a selected date formatted as below:

$selectedDate = 2010/02/24 

I want to check it is both todays date and it is past 9pm on the server and set a value if it is.

I can get a time by using the following:

$checkTime = date("H:i");

I want to create something like:

if ($checkTime > 21:00 && $selectedDate == date("Y/m/d")) { //do my stuff }

But a bit unsure of the syntex.

Many thanks for any help

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐