How do you convert between 12 hour time and 24 hour time in PHP?

$time = '5:36 pm';

// 24-hour time to 12-hour time 

$time_in_12_hour_format = date("g:i a", strtotime($time));

// 12-hour time to 24-hour time 

$time_in_24_hour_format = date("H:i", strtotime($time));

Comments

Popular posts from this blog

Why Mark Zuckerberg’s Choose 4

Error message when I run sudo: unable to resolve host (none)

Convert MBR to GPT