Reputation: 45
This is the query datemade is date datatype in MYSQL
$sqlCommand ="SELECT blogbody,datemade FROM blogpages WHERE bpid='$blogid'";
This is the fetch array
$dmade=$row["datemade"];
I echo out the date how can we display it as ex: November 2014
Upvotes: 0
Views: 2380
Reputation: 421
Just use MySQL DATE_FORMAT function.
Change your query to:
$sqlCommand ="SELECT blogbody, DATE_FORMAT(datemade, '%M %Y') AS datemade FROM blogpages WHERE bpid='$blogid'";
Upvotes: 0
Reputation: 14614
Use DATE_FORMAT function with '%M %Y'
as the format parameter to display month name and four digit year like below
DATE_FORMAT(datemade, '%M %Y')
This is the modified query
$sqlCommand = "SELECT blogbody, DATE_FORMAT(datemade, '%M %Y') AS datemade FROM blogpages WHERE bpid='$blogid'";
Upvotes: 1