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...
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)
3 Answers
Did you try this?
SELECT title, date(timestamp) AS MYDATE
FROM Team_Note TN
WHERE id = 1
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;