SQL Convert String To Datetime

How to Extract Time from a String in MySQL

In this tutorial, you will learn how to extract the time section from an input timestamp string in MySQL databases.

Example

Suppose you have an input string in a long format as shown:

'Sunday 1 January 2023, 13:50:44'

If we wish to extract the time part from the string above and get the value 13:50:44, we can use the query:

select date_format
Great! Next, complete checkout for full access to Cloudenv.
Welcome back! You've successfully signed in.
You've successfully subscribed to Cloudenv.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.