In PHP, you can effortlessly use the DateTime class to determine if the present date/time has advanced beyond a specific date/time.
Consider the following example:
<code class="php">if (new DateTime() > new DateTime("2010-05-15 16:00:00")) { # The current time exceeds 2010-05-15 16:00:00. # In other words, it has passed. }</code>
This code utilizes the DateTime constructor, where the argument is a string adhering to specific parsing rules. By comparing the current date/time with the specified date/time (05/15/2010 at 4 PM), you can ascertain whether the present time has surpassed the designated moment.
The above is the detailed content of How to Check if the Current Date/Time Has Passed a Specific Date/Time in PHP?. For more information, please follow other related articles on the PHP Chinese website!
if($res){
return json_encode(array('code'=>1,'msg'=>'成功'));
}else{
return json_encode(array('code'=>0,'msg'=>'失败'));
}
}
public function
}