trs.net wrote:
> Here's the code I'm using, which obviously isn't
working.
> <?php echo date($row_rsGigs['date_gig'], 'M D');
?>
MySQL dates are stored in human readable format, such as
2008-04-08. The
PHP date() function requires a Unix timestamp. The two don't
mix.
Even if they did mix, you have the arguments the wrong way
round in the
date() function. The formatting characters come first, not
the date.
The best way to deal with your requirement is to get the SQL
query to
handle everything for you.
SELECT DATE_FORMAT(date_gig, '%b') AS mon,
DATE_FORMAT(date_gig, '%a') AS weekday,
DAYOFMONTH(date_gig) AS day
FROM myTable
That gives you $row_rsGigs['mon'] as the abbreviated month,
$row_rsGigs['weekday'] as the abbreviated day of the week,
and
$row_rsGigs['day'] as the day of the month.
Learn all about MySQL date and time functions here:
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/