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 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. 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
Archived
This topic is now archived and is closed to further replies.