SQL
/* The SQL syntax I used to create my 'time' field:
ALTER TABLE `files` ADD `time` DATE NOT NULL AFTER `id`;
*/
then I added the function 'NOW()' to the values I wanted.
PHP
<?php
// Selects all the files from my table 'files'. It contains 'title', 'content', 'time'.
$get_files = mysql_query("SELECT * FROM
files ORDER BY id
DESC LIMIT 0, 3", $connection);
echo "<div class='display-files'>"; // Wraps this around the Article.
while($files = mysql_fetch_array($get_files)) {
$title_get = $files['title']; // Gets the 'title' from table 'files'.
$content_get = $files['content']; // Gets the 'content' from table 'files'.
$date_get = $files['date']; // Gets the 'date' from table 'files'.
echo "<article>"; // Article is just to organize the content.
echo "<h2>{$title_get}</h2>"; // Displays 'title'.
echo "<p style='white-space: pre-line'>{$content_get}</p>"; // Displays 'content'.
echo "<hr /><p>Created: <em>{$date_get}</em><br /></p>"; // Displays 'date'.
echo "</article>";
}
echo "</div>";
?>
The variables should have explained well enough, but I added comments . . . just in case for the people who have troubles reading my code. Plus, first question I am doing.
The Result: 2016-03-14
Anyways, I am here to ask if there is a way to get the 'time' from my DB/Database and give it a nice readable format.
e.g: Mar 14 2016