You are here: Re: To Get a Date into MySql: there must be a better way. « PHP Programming Language « IT news, forums, messages
Re: To Get a Date into MySql: there must be a better way.

Posted by Sandman on 03/12/06 20:36

In article <fHIQf.877$dw4.246@newsfe3-gui.ntli.net>,
Colin McKinnon
<colin.thisisnotmysurname@ntlworld.deletemeunlessURaBot.com> wrote:

> Sandman wrote:
>
> > In article <op.s59iljj9fdqzms@mercury>,
> > "hugh webster" <hwebster@bluewin.ch> wrote:
> >
> >> MySql seems to only accept dates as 'yyyy-mm-dd'. How do I do that when
> >> the user might input dd/mm/yy, or d.m.yyyy (I'm in Europe)? I know I can
> >> do sscanf, or explode to rebuild the date string - but there must be a
> >> better way. Is there a FAQ somwhere?
> >
> > Well, there is a function - strtotime(), which will take plain english
> > and try to turn it into a timestamp.
> >
>
> Which is very Americanised, and does not have any mechanism for providing a
> hint to the underlying code.
>
> Best solution is not to allow users to enter a date into a text field. An
> ugly solution is to provide dropdowns for day number, month name and year.

I don't know why though. I am using strtotime() for swedish dates. I
just have to have a set of translations for it. In my CMS system,
users enter dates in a text field, and the system warns you if it
can't make a real date out of it.





--
Sandman[.net]

 

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

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