Here you go:
select DATE_FORMAT( DateTime, '%M %D %Y' ) as formatted_date,
Platform,
Public,
other_fields
from Features
where Platform='pc'
and Public='Y'
order by DateTime asc
limit 0,3
;
Now, you should rename the DateTime field as Bob sudgested,
and you should really name the fields in your query instead
of being lazy and writing select *.
look at other ways to format your dates and times at
http://www.mysql.com/doc/D/a/Date_and_time_functions.html and
search in the page for the string DATE_FORMAT...
When sorting, mysql uses the amount of milliseconds to sort by
and as Bob said, it doesn't have anything to do with the
presentation of tha date..
mvh:
Pal Wester, programmerer
never.no as, stortingsgt 30, 0161 Oslo
tlf: 22 01 66 20, fax: 22 01 66 21
direkte: 22 01 66 34, 906 900 62
http://never.no - icq:103476059
~ f u cn rd ts u prb a gk ~
> -----Opprinnelig melding-----
> Fra: Bob Hall [mailto:[EMAIL PROTECTED]]
> Sendt: 11. februar 2001 16:03
> Til: [EMAIL PROTECTED]
> Emne: Re: Date???
>
>
> >Hi,
> >
> >I`m selecting information from my MySQL as follows...
> >
> >Select * FROM Features WHERE Platform='pc' and Public='Y' Order
> by DateTime
> >ASC LIMIT 0,3
> >
> >I am storing the field DateTime as a date when selected it looks
> like this
> >2001-05-05 but I want to change it so it looks like May 5th
> 2001, I`ve looked
> >about and found the DATE_FORMAT method but I have no idea how to
> use it on my
> >select without it effecting my Order by, anyone have any tips?
> >
> >Thanks
> >Ade
>
> Sir, change the name of your DateTime column. DateTime is a reserved
> word. Even if it isn't causing you problems now, it will in the
> future.
>
> Why would reformatting the date in your SELECT clause alter the the
> way your ORDER BY clause works? You're only reformatting the output.
> You're not changing the data in the column, and your ORDER BY refers
> to the name of the column, not to an alias for the reformatted output.
>
> Bob Hall
>
> Know thyself? Absurd direction!
> Bubbles bear no introspection. -Khushhal Khan Khatak
>
> ---------------------------------------------------------------------
> 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
---------------------------------------------------------------------
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