|
Posted by mattmika on 08/24/07 02:51
On Fri, 24 Aug 2007 03:17:15 +0200, Rik <luiheidsgoeroe@hotmail.com>
wrote:
>On Fri, 24 Aug 2007 01:23:53 +0200, MattMika <mattmika@hotmail.com> wrote:
>
>> Is there a way to format datetime (2007-08-23 07:00:00) into something
>> like Aug. 23rd, 2007 7am within a query?
>>
>> A little explanation. This is an events table that is queried from a
>> PHP class triggered from flash via AMFPHP, the mysql result is then
>> sent back to Flash.
>>
>> I plan of having php forms to add, edit and delete entries in this
>> table so was thinking I could just have a datetime field and a
>> format_date field that would get a formatted version of the datetime
>> when inserted or updated.
>>
>
>Is it MySQL? If so:
>http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format
Yes it is MySQL5. I didnt explain very well. I have a datetime field
that is populated in the db. Heres the query I have:
"SELECT events_date as Date, events_title as Event, events_description
as Description FROM events ORDER BY Date ASC"
What I am wondering is can I select that datetime field and format it
in a query.
Something like:
"SELECT date(events_date, '%b %a %Y') as Date, events_title as Event,
events_description as Description FROM events ORDER BY Date ASC"
I havent spent a WHOLE lot of time looking yet, but it doesnt look
like something that can be done as what I've tried so far returns
errors.
TIA
Navigation:
[Reply to this message]
|