Ok, dumb mistake... Remind me not to code so late at night. :)
With that fixed, I now get
mysql> select DATE_FORMAT(post_timestamp, '%M %d, %Y') from guestbook;
+------------------------------------------+
| DATE_FORMAT(post_timestamp, '%M %d, %Y') |
+------------------------------------------+
| June 04, 2001 |
| June 04, 2001 |
+------------------------------------------+
which is exactly the conversion I'd like. However, if I run a query like
mysql> SELECT name,city,DATE_FORMAT(post_timestamp, '%M %d, %Y') FROM
guestboo
k;
+------------+-----------+------------------------------------------+
| name | city | DATE_FORMAT(post_timestamp, '%M %d, %Y') |
+------------+-----------+------------------------------------------+
| Alec Smith | Lyndhurst | June 04, 2001 |
| Alec Smith | Lyndhurst | June 04, 2001 |
+------------+-----------+------------------------------------------+
I get the DATE_FORMAT function call as the field name, which isn't
especially convenient when trying to access the data. Is there a
way to have MySQL assign the field name returned to post_date or similar
for easier access under PHP4, Perl, etc?
Alec
On Mon, 4 Jun 2001, Don Read wrote:
>
> On 04-Jun-01 Alec Smith wrote:
> > What would be the correct query to convert a date stored in MySQL in
> > a
> > DATETIME field to month_name month_date, year format at the same time
> > I'm
> > pulling a bunch of other data from the same row as the field with the
> > date I need converted? I've tried something like the below without
> > success:
> >
> > SELECT name,city,state,country,message,DATE_FORMAT(post_timestamp,
> > '%M %d, %Y),website_url,website_name FROM table
>
> ^ close your quote
> >
> > With the above MySQL comes back with a syntax error... Where have I
> > gone
> > wrong? Probably something obvious... But hey, I'm just learning SQL.
> >:)
> >
>
> --
> Don Read [EMAIL PROTECTED]
> -- It's always darkest before the dawn. So if you are going to
> steal the neighbor's newspaper, that's the time to do it.
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php