从MYSQL表中提取没有时间的日期[复制]

This question already has an answer here:

I am using the followup procedure to display date from mysql tabe:

<? echo $rrow[encoded_date]; ?>

Now the format of encoded_date cell is: 2013-03-20 01:52:39 .

My question is how to extract only the date without the time.

</div>

You can do it with PHP:

$yourDateTime = "2013-03-20 01:52:39";
date('Y-m-d', strtotime($yourDateTime));

You can use DATE_FORMAT()

SELECT DATE_FORMAT(dateColumn, '%Y-%m-%d') encoded_date