Click Upvote Click Upvote - 10 days ago 6
MySQL Question

Converting an AM/PM time to 24 hours format using PHP or MySQL?

I have a string of time such as: 6:00 AM, 7:30 PM, etc. It can easily be changed to 6:00:00 AM, 7:30:00 PM, etc as well.

I'm looking for a way to quickly convert this time into a 24 hour format, e.g 7:30 PM = 19:30:00.

Is there any PHP or MySQL function which has this capability, or do I have to devise my own?

Answer
STR_TO_DATE( `column_here`, '%l:%i %p' )

Read more here.

EDIT

Edited '%l:%M %p' to '%l:%i %p'