ainoy31 Posted October 26, 2007 Share Posted October 26, 2007 Can anyone direct me to a good article on converting from standard to Military time? Much appreciation. AM Quote Link to comment https://forums.phpfreaks.com/topic/74937-convert-from-standard-to-military-time/ Share on other sites More sharing options...
premiso Posted October 26, 2007 Share Posted October 26, 2007 www.php.net/date look at that as it has all the masks needed to convert a timestamp to show military time. Quote Link to comment https://forums.phpfreaks.com/topic/74937-convert-from-standard-to-military-time/#findComment-378914 Share on other sites More sharing options...
darkfreaks Posted October 26, 2007 Share Posted October 26, 2007 <?php function miltoampm($hour) { $ampm = ($hour >=12 && $hour <24) ? "PM" : "AM"; $newhour = ($hour % 12 === 0) ? 12 : $hour % 12; return $newhour . ' ' . $ampm; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/74937-convert-from-standard-to-military-time/#findComment-378917 Share on other sites More sharing options...
Barand Posted October 27, 2007 Share Posted October 27, 2007 <?php $time = '5 pm' ; echo date ('H:i', strtotime($time)); // --> 17:00 ?> Quote Link to comment https://forums.phpfreaks.com/topic/74937-convert-from-standard-to-military-time/#findComment-379030 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.