PHP convert time 12 to 24 hours and vice versa

Posted: September 28, 2010 in Php

// 24-hour time to 12-hour time
$time_in_12_hour_format  = DATE(“g:i a”, STRTOTIME(“23:15”));

// 12-hour time to 24-hour time
$time_in_24_hour_format  = DATE(“H:i”, STRTOTIME(“3:20 pm”));

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s