O
O
Outsider V.2015-03-19 22:24:40
MySQL
Outsider V., 2015-03-19 22:24:40

How to format timestamp to date?

If I request the value of a timestamp field using "SELECT date FROM entries WHERE id=n", I get the format string yyyy-mm-dd hh-ii-ss , but I need to get only yyyy-mm-dd . Prompt the query string.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlexLIn, 2015-03-19
@Audiophile

date_format(registration, '%Y-%m-%d')
dev.mysql.com/doc/refman/5.5/en/date-and-time-func...
PS DATE_FORMAT
(FROM_UNIXTIME(`date `), ' %Y-%m-%d') as "Date" FROM `entries `
should work for your case.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question