Re: PHP Date Search Question
- From: "Alex" <mincua@xxxxxxxxx>
- Date: 3 Jun 2005 19:13:42 -0700
You forgot to tell him that if he uses text inputs for dates he would
have to use strtotime function or something like that because if you do
a query like SELECT * FROM test WHERE date='Jan 1 2005' mysql would
never return what you want ... or use postgresql :D.
The mysql data format is this 2005-12-31 and the dates are compared as
strings so it wouldn't convert 'Jan 1 2005' to '2005-01-01'
automatically.
I would tell him to use 3 selects and compose the date like
'{$_POST['to_year']}-{$_POST['to_month']}-{$_POST['to_day']}' because
even if he uses strtotime it wouldn't cover any date syntax.
--
Alexandru Mincu <mincua@xxxxxxxxx>
Tel: +40745515505/+40723573761
.
- Follow-Ups:
- Re: PHP Date Search Question
- From: Dave
- Re: PHP Date Search Question
- References:
- PHP Date Search Question
- From: Greg
- Re: PHP Date Search Question
- From: Dave
- PHP Date Search Question
- Prev by Date: Re: problem with some code..
- Next by Date: Re: PHP Date Search Question
- Previous by thread: Re: PHP Date Search Question
- Next by thread: Re: PHP Date Search Question
- Index(es):