Development

SQL Convert String To Datetime

Captain Salem

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
Share
Comments
More from Cloudenv

Cloudenv

Developer Tips, Tricks and Tutorials.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Cloudenv.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.