Re: checking user input of MM-DD-YYYY
| From: | Andrew Ballard | Date: | Tue, 15 Jan 2008 19:47:21 +0000 |
| Subject: | Re: checking user input of MM-DD-YYYY | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-267331@lists.php.net to get a copy of this message | ||
On Jan 15, 2008 2:38 PM, Richard Lynch <ceo@l-i-e.com> wrote:
> On Tue, January 15, 2008 12:31 pm, Adam Williams wrote:
> > Andrew Ballard wrote:
> > I don't see the point in needing to convert it to a timestamp. The
> > length_start and length_end fields in MySQL are defined as date
> > fields.
> > All I care about is the date, not the hours/minutes/seconds. If I
> > insert it as date('Y-m-d', $length_start) then when I SELECT it back
> > out, I will still have to do a date conversion back to MM-DD-YYYY when
> > I
> > display it to the user.
>
> No.
Well, true. I guess what I meant is that MySQL requires to be entered
as YYYY-MM-DD, and they always (at least that I've seen) comes back
out the same way. I don't really know how it's actually stored. I'm
sure that depends on the engine as well.
> MySQL is going to store it internally however it wants, regardless of
> how you get it in there.
>
> And you'll want to format it (or use MySQL default) independent of
> what you use to get it in there.
Exactly.