Select Date from Timestamp Sql

i have the following row in my database:

'1', '1', '1', 'Hello world', 'Hello', '2014-01-14 17:33:34'

Now i wish to select this row and get only the date from this timestamp:

i have tried the following:

SELECT title,   FROM_UNIXTIME(timestamp,'%Y %D %M') AS MYDATE FROM Team_Note TN WHERE id = 1

I have also tried:

SELECT title,   DATE_FORMAT(FROM_UNIXTIME(`timestamp`), '%e %b %Y') AS MYDATE FROM Team_Note TN WHERE id = 1

However these just return an empty result (or well i get the Hello part but MYDATE is empty)

1

3 Answers

Did you try this?

SELECT title, date(timestamp) AS MYDATE
FROM Team_Note TN
WHERE id = 1
0

You need to use DATE function for that:

SELECT title,   
DATE(timestamp) AS MYDATE 
FROM Team_Note TN 
WHERE id = 1

In PostgreSQL:

SELECT DATE(r.data_registro) FROM registro_financeiro r WHERE id = 1;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest