if you want to Convert 12 to 24 hour time and vice versa in PHP then use this code.

// 24-hour time to 12-hour time 
$time_in_12_hour_format  = DATE("g:i a", STRTOTIME("13:30"));
 
// 12-hour time to 24-hour time 
$time_in_24_hour_format  = DATE("H:i", STRTOTIME("1:30 pm"));
 

Have any doubt, then comment here!

Leave a Reply

Your email address will not be published. Required fields are marked *