On 27 Oct 2006 in macromedia.dreamweaver.appdev, AdonaiEchad
wrote:
> I have been working on a database and my output of a
date shows as
> such.
>
> On my users selection I want to see when they had
registered. When
> I view it shows the following.
> 2006-10-23 11:30:47, how can I make the format be Oct
23, 2006
> 11:30:47.
>
> My PHP code shows the following...
> <?php echo $row_rsUsers['date']; ?>
>
> In my calendar section I have the following as well
where you enter
> 2006-10-23. I want it to be displayed as October 23,
2006. The PHP
> code is the same.
> <?php echo $row_rsCalendar['date']; ?>
>
> Is there a php function to convert these to a long date?
It looks like you're using MySQL. You can do it in your SQL
statement:
SELECT date_format(myDateField, '%b %e %Y %T') AS
myFormattedDate,
username FROM myTable ORDER BY myDateField DESC
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
You can also do this in PHP; however, it involves converting
to *nix
timestamps, and my personal preference is for doing it in
MySQL.
http://www.php.net/manual/en/function.date.php
--
Joe Makowiec
http://makowiec.net/
Email:
http://makowiec.net/email.php