Hi everyone, I have written the following function that converts from 12-hour time to 24-hour time. It is not the best way to do it but since I had to add the 24-hour time to a system that was previously built with 12-hour time I came up with this: function get_m_time($AppntmntTime){ $Ntime = explode(":",$AppntmntTime); if($Ntime[1] = "00am"){ $mtime = $Ntime[0]; } else { $mtime = $Ntime[0]+12; } die($AppntmntTime."<br/>".$Ntime[1]."<br/>".$mtime); return $mtime; } PHP: Note that the die function is just in there temporarily while I am trying to debug it. When I pass in a time that has 'pm' in it for example 1:00pm I get the following output from the die function. 1:00pm (AppntmntTime) 00am (Ntime[1]) 1 (mtime) However the 2nd line there should be 00ppm and the last line should be 13. Any idea why the explode function is doing that? Thanks for any help in advance, I really appreciate it.
I just figured it out, the if statment had = instead of == so it was assigning the $Ntime[1] element to be "00am".