I have a string like "6:15pm". Is there any function in PHP which will convert it directly to 24 hr format. ie to "18:15"?
                +4 
                A: 
                
                
              
            I would suggest using strtotime() with date():
print date("H:i", strtotime("6:15pm"));
                  Jonathan Sampson
                   2009-12-31 07:12:01
                
              
                +1 
                A: 
                
                
              
            You can do this with strtotime():
echo date('H:i', strtotime('6.:15pm'));
                  cletus
                   2009-12-31 07:13:52
                
              
                +1 
                A: 
                
                
              
            //Call this once before the 1st date/time operation
date_default_timezone_set('Europe/Zurich');
echo date('H:i', strtotime('6:15pm'));
                  Ivan Krechetov
                   2009-12-31 07:15:43