MySQL Select Seconds from Timestamp Example

MySQL

Nicesnippets

07-02-2022


Hi Friends,

I am going to explain you example of MySQL select seconds from timestamp example. You will learn MySQL - search timestamp by seconds of day. In side this article we will see the MySQL - extract seconds from DATETIME / TIMESTAMP / TIME.

This article will give you simple example of how to display only seconds and seconds in MySQL?. We will use get search how to find the MySQL get date difference in seconds code example.

So let's start following example.

Table : users


Solution SQL Query:

SELECT

id,

name,

email,

TIME_FORMAT(created_at, '%H:%i:%s') as time,

TIME_FORMAT(created_at, '%H') as hour,

TIME_FORMAT(created_at, '%i') as minute,

TIME_FORMAT(created_at, '%s') as minute

FROM `users`

Output:

I hope it will help you...