Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select date from timestamp SQL

Tags:

sql

mysql

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)

like image 847
Marc Rasmussen Avatar asked Nov 29 '22 01:11

Marc Rasmussen


1 Answers

Did you try this?

SELECT title, date(timestamp) AS MYDATE
FROM Team_Note TN
WHERE id = 1
like image 81
Gordon Linoff Avatar answered Dec 09 '22 01:12

Gordon Linoff