I have a table with a timedate collumn. I want to get the text of the article and its creation date, than to output them on my page.
How can I just get only the date value from a query or php script manupulation?

6 Years
Discussion Span
Last Post by pritaeas

Misread your question. I'll leave my answer here for those who are looking for the same, but with a timestamp column

You can either select the timestamp from MySQL returning it in the format you desire - see FROM_UNIXTIME

SELECT FROM_UNIXTIME(`timestamp`, '%Y %D %M') AS `date FROM `table`;
-- 2007 30th November

Or, you can convert the timestamp into a date using PHP - see date

echo date('Y jS M', $timestamp);
// 2007 30th November

Edited by blocblue


At first thank you for your help.
Maybe I was not clear in my description.
I am using this query: SELECT * FROM scms_latest_news;
The table scms_latest_news has 3 collunms id, content, add_date

$query = "SELECT * FROM scms_latest_news;";

I want to output the content is : $row['content'] . "Creation date:" . $row['???????']

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.