How does PHP get 24-hour timekeeping time? Use this article to provide a custom function to get the current time, and use the 24-hour timekeeping method to calculate the time.
The code is as follows |
Copy Code |
function GetTime () { $time = ""; Morning Time $h 1=date ("H") >12? (Date ("H") -12):d ate ("H"); Afternoon time $h 2= ((Date ("H") +12) >=24)? Date ("H"):(date ("H") +12); Judged whether it was morning if (Date ("a") = = "AM") { $time =date ("y-m-d $h 1:i:s"); } else {//To determine if it is an afternoon $time =date ("y-m-d $h 2:i:s"); } return $time; } |
http://www.bkjia.com/PHPjc/628993.html www.bkjia.com true http://www.bkjia.com/PHPjc/628993.html techarticle How does PHP get 24-hour timekeeping time? Use this article to provide a custom function to get the current time, and use the 24-hour timekeeping method to calculate the time. The code follows the copy generation ...