You are here: Re: Format datetime with query? « PHP SQL « IT news, forums, messages
Re: Format datetime with query?

Posted by Tom on 08/24/07 17:46

On Thu, 23 Aug 2007 17:23:53 -0600, MattMika 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.
>
>Theres got to be a better solution to avoid having two date fields in
>my db. Any suggestions?
>
>TIA
>Matt Mika


You can use the DATE_FORMAT function to pull out the specific fields you needed.
As an example if I needed it as "MM-DD-YYYY", I would use...

SELECT DATE_FORMAT(Date_Column, '%m-%d-%Y') from Table where .....


Tom
--
NewsGuy Takes Usenet Cellular!
Download newsgroup MP3's to your Cell or PDA
Free Trial - http://newsguy.com/cellphone.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация