tjburke79 Posted February 8, 2014 Share Posted February 8, 2014 Hello, I was wondering if someone can help me out in formatting this time format so it is in a 24 hour format? $time = "9:33p EST"; Thanks for any help in advance Quote Link to comment https://forums.phpfreaks.com/topic/286044-time-format-help/ Share on other sites More sharing options...
ginerjm Posted February 8, 2014 Share Posted February 8, 2014 Refer to the php manual and look up strtotime and date functions. Quote Link to comment https://forums.phpfreaks.com/topic/286044-time-format-help/#findComment-1468223 Share on other sites More sharing options...
Barand Posted February 8, 2014 Share Posted February 8, 2014 you will probably have to replace the "p" with "pm" $time = "9:33p EST"; $dt = new DateTime(str_replace('p', 'pm', $time)); echo $dt->format('H:i:s'); // --> 21:33:00 Quote Link to comment https://forums.phpfreaks.com/topic/286044-time-format-help/#findComment-1468225 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.