How to get AM/PM from a datetime in PHP
Md Riyazuddin
Verified
You need to convert it to a UNIX timestamp using strtotime and then back into the format and also you require to use the date function.
$currentDateTime = '08/04/2010 22:15:00'; $newDateTime = date('h:i A', strtotime($currentDateTime)); echo $newDateTime;
Comments
webnewcon 2023-10-13 07:38:17
good
Leave a Comment