Skip to main content
Participating Frequently
March 14, 2007
Answered

PHP/MySQL Date display format

  • March 14, 2007
  • 3 replies
  • 506 views
Can someone help me out here. I am trying to format my date. My MySQL is a "datetime". How ever I would like to display only the month, day, year like so "Jan,15,2007"

Here is my current code, what should I add to make it do what I want.

<?php echo $row_Recordset1['review_date']; ?>

Thanks
This topic has been closed for replies.
Correct answer Newsgroup_User
Try this:

<?php echo Date("M d, Y", strtotime($row_Recordset1['review_date'])); ?>

--
Ken Ford
Adobe Community Expert
Fordwebs, LLC
http://www.fordwebs.com


"newhorizonhosting.com" <charles@dieselinteractive.com> wrote in message news:et7lf6$q8a$1@forums.macromedia.com...
> Can someone help me out here. I am trying to format my date. My MySQL is a
> "datetime". How ever I would like to display only the month, day, year like so
> "Jan,15,2007"
>
> Here is my current code, what should I add to make it do what I want.
>
> <?php echo $row_Recordset1['review_date']; ?>
>
> Thanks
>

3 replies

Inspiring
March 14, 2007
newhorizonhosting.com wrote:

> Can someone help me out here. I am trying to format my date. My MySQL is a
> "datetime". How ever I would like to display only the month, day, year like so
> "Jan,15,2007"


mysql> SELECT DATE_FORMAT(NOW(),"%b %e, %Y") as review_date;
+--------------+
| review_date |
+--------------+
| Mar 14, 2007 |
+--------------+
1 row in set (0.00 sec)

Best done in mysql.
Mick

>
> Here is my current code, what should I add to make it do what I want.
>
> <?php echo $row_Recordset1['review_date']; ?>
>
> Thanks
>
Inspiring
March 14, 2007
On Wed, 14 Mar 2007 02:08:38 +0000 (UTC), "newhorizonhosting.com"
<charles@dieselinteractive.com> wrote:

>Can someone help me out here. I am trying to format my date. My MySQL is a
>"datetime". How ever I would like to display only the month, day, year like so
>"Jan,15,2007"

You should format it using your SQL statement. See this:

http://www.dan.co.uk/mysql-date-format/
--
Steve Fleischer
steve at flyingtigerwebdesign dot com
Hong Kong
Newsgroup_UserCorrect answer
Inspiring
March 14, 2007
Try this:

<?php echo Date("M d, Y", strtotime($row_Recordset1['review_date'])); ?>

--
Ken Ford
Adobe Community Expert
Fordwebs, LLC
http://www.fordwebs.com


"newhorizonhosting.com" <charles@dieselinteractive.com> wrote in message news:et7lf6$q8a$1@forums.macromedia.com...
> Can someone help me out here. I am trying to format my date. My MySQL is a
> "datetime". How ever I would like to display only the month, day, year like so
> "Jan,15,2007"
>
> Here is my current code, what should I add to make it do what I want.
>
> <?php echo $row_Recordset1['review_date']; ?>
>
> Thanks
>