List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 28 2002 3:57pm
Subject:Re: Mysql Date Functions - input
View as plain text  
At 14:02 +0000 2/28/02, George Pitcher wrote:
>Hi all,
>I asked this question on the PHP-DB list but everyone was asleep (no
>=====  =====  ===== ===== ===== ===== =====
>I have a site where dates are being displayed and also entered by users. I
>don't want to offend them by asking them to use the yyyy-mm-dd format or to
>split the date into its constituent parts.
>I am displaying by using the MySQL Date_Format syntax and that's fine. I get
>dd/mm/yyyy and I want to be able to have the user enter 'dd/mm'yyyy' into a
>form and have it put into MySQL in the yyyy-mm-dd format.
>Now I have written a function in php to do this but I might be missing an
>easier, more elegant/efficient way of doing this.

I'd leave the checking in PHP.  You have access to pattern matching and
reformatting capabilities that are as easy or easier to use than what
you can do with SQL, plus if you issue a query to reformat the
date and it turns out to be bad, you ran the query for nothing.

>Any suggestions?
>George P, in Edinburgh

Mysql FunctionsAmit Dilip Lonkar28 Feb
  • Mysql Date Functions - inputGeorge Pitcher28 Feb
    • Re: Mysql Date Functions - inputPaul DuBois28 Feb
RE: Mysql Date Functions - inputJohn Lodge28 Feb
Re: Mysql Date Functions - inputMarjolein Katsma28 Feb
  • Re: Mysql Date Functions - inputKeith C. Ivey28 Feb
Re: Mysql Date Functions - inputMarjolein Katsma1 Mar