php time format conversion
Convert seconds to hours, minutes and seconds
function cktime($billsec){ $cktime = ''; if($billsec>'0'){ $cktime = gmstrftime('%H:%M:%S',$billsec); } return $cktime; }
Generate the current time Stamp and display the time in the format
$time = time();//获取时间戳 $nowtime = date('Y-m-d H:i:s',$time);//生成规定的时间格式
Convert the exact event to a timestamp
$oldtime = '2010-11-10 22:19:21'; $catime = strtotime($oldtime);
Print the timestamp at this time tomorrow
strtotime(”+1 day“)
Print the time stamp at this time yesterday
strtotime(”-1 day“)
Print the timestamp of next week at this time
strtotime(”+1 week“)
Print the PHP timestamp of the specified day of next week
strtotime(”next Thursday“)
Print the timestamp of the specified day of last week
strtotime(”last Thursday“)
Recommended tutorial: "PHP tutorial"
The above is the detailed content of How to convert time format in php. For more information, please follow other related articles on the PHP Chinese website!