You are here: Re: Text field as date (MySQL) « PHP Programming Language « IT news, forums, messages
Re: Text field as date (MySQL)

Posted by Chris Tate-Davies on 08/02/07 10:11

On 2 Aug, 11:07, Hendri Kurniawan <hckurnia...@gmail.com> wrote:
> Chris Tate-Davies wrote:
> > Hello. I have a generic table used for many different generic
> > functions. the fields are mainly varchar's but one of these varchars
> > contains dates (in the format dd/mm/yyyy) for one reason or another.
>
> > My question is, can I perform a query on this table, using date
> > functions on this varchar field? I.e. search for the latest date?
>
> > Thanks, Chris
>
> Take a look at STR_TO_DATE, and use it like:
> SELECT * FROM table ORDER BY STR_TO_DATE(coldate, '%d/%m/%Y')
>
> Let us know whether it works or not
>
> Hendri Kurniawan

Thankyou Hendri, that works a treat if I convert the field and the
search criteria to date.

Thanks for your help.

Chris.

 

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

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