Skip to main content
August 30, 2008
Question

PHP Date Funcing using recordset

  • August 30, 2008
  • 2 replies
  • 414 views
How do I make a date function using recordset. I tried this method but I am getting an error.
<?php echo date($row_userIDs['dateOfReg'], "M j, Y"); ?>
This topic has been closed for replies.

2 replies

Inspiring
August 30, 2008
On 29 Aug 2008 in macromedia.dreamweaver.appdev, AdonaiEchad wrote:

> How do I make a date function using php and my recordset. I tried
> this method but I am getting an error. <?php echo
> date($row_userIDs['dateOfReg'], "M j, Y"); ?>

It tends to be easier (at least for me) to do the formatting in the
recordset. Assuming you're using MySQL:

SELECT field1, field2, DATE_FORMAT(dateOfReg, '%M %e, %Y') AS myDate FROM
myTable ...

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/contact.php
Inspiring
August 30, 2008
Try this:

<?php echo date("M j, Y", strtotime($row_userIDs['dateOfReg'])); ?>

http://us2.php.net/date

http://us.php.net/strtotime

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


"AdonaiEchad" <webforumsuser@macromedia.com> wrote in message
news:g9aesk$eh1$1@forums.macromedia.com...
> How do I make a date function using php and my recordset. I tried this
> method but I am getting an error.
> <?php echo date($row_userIDs['dateOfReg'], "M j, Y"); ?>

August 30, 2008
Thank you for all of your help. I have tried the MySQL version and I do prefer that, but some how I had to do something different that is only php and not touch the MySQL database.