ghurty Posted January 25, 2010 Share Posted January 25, 2010 Would this work? I will be passing on a number as the variable for $hour and $minute and also eaither a AM or PM for $ampm. $time_in_24_hour_format = DATE("H:i", strtotime("{$hour}:{$minute} {$ampm}")); Thanks Quote Link to comment https://forums.phpfreaks.com/topic/189793-would-this-use-of-strtotime-work/ Share on other sites More sharing options...
premiso Posted January 25, 2010 Share Posted January 25, 2010 Try it out and see. The best way to see if something works is to try it: $hour = 1; $minute = 30; $ampm = "pm"; $time_in_24_hour_format = DATE("H:i", strtotime("{$hour}:{$minute} {$ampm}")); echo $time_in_24_hour_format . " 24 hour time"; If it displays the 24 hour time, it worked. If not, you can use the mktime function instead of strtotime. Quote Link to comment https://forums.phpfreaks.com/topic/189793-would-this-use-of-strtotime-work/#findComment-1001578 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.