0

Hey there. I'm trying to retrieve a date from an SQL table. The original formate of the date is as follows:

0000-00-00 00:00:00

I want to try and change the format into: Month Date, Year e.g. May 17, 2014

<?php
$page_title = 'View the current users';
include('header.inc');

require_once('mysql_connect.php');
try{

      $query = ( "SELECT last_name, first_name, registration_date \n"
        . "FROM `users` \n"
        . "ORDER BY registration_date ASC");        


    $statement = $db->query($query);
    while($row = $statement->fetch(PDO::FETCH_ASSOC)){
        echo $row['last_name'] . " " . $row['first_name'] ." " . 
             $row['registration_date'];
        echo "<br>"; 
    }
}catch(PDOException $e){
        $message = '<p>Something went wrong!</p><p>' . $e->getMessage() . '</p>';
}
include('footer.inc')
?>

Will I have to put the 'registration_date' into an array and chnage the format from there?

Many thanks

1
Contributor
1
Reply
5
Views
3 Years
Discussion Span
Last Post by Alonso_1
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.