Re: PHP query on "date" field
| From: | Jason Wong | Date: | Tue, 30 Oct 2001 20:40:46 +0000 |
| Subject: | Re: PHP query on "date" field | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-13867@lists.php.net to get a copy of this message | ||
On Wednesday 31 October 2001 04:34 am, Jason wrote:
> This portion of the site was done by a previous employee and well
> you know the expression.. "If its not broke don't fix it." Well now
> that I cannot query the db by the date it is now broke and I am still
> figuring out how MySQL is taking entries to the db so I figured this
> bit of information would maybe sum up the problem in the date field.
> I have been reading up on the date function in the MySQL book I have
> but somethings it just doesn't cover. So please excuse my being
> vague. Thanks,
> Jason
What data type is your date field -- CHAR? INT? DATE?
> > date("H") converts to a 24-hour clock. That is, 00 is 12
> > mid-night, 01 is
>
> 1
>
> > AM, 13 is 1 PM, 14 is 2 PM, 23 is 11 PM, etc.
> >
> > I do not understand the reasons for your computation that, say 00,
> > is 10
A stab in the dark -- could it be some time-zone adjustment?
> > Ok well I have made the changes and tested it out but using the
> > search string 10/15/2001 still provided no results...
The changes would only work if your date field is of data type DATE (or
DATETIME).
> > here is the
> > script that parses the date for entry into the database...
> > $date = (date("m/d/Y")) ; #this date is used in the online
> > database
> > I am wondering if I should let the date be put into the db as
>
> 2001-15-10...
Changing the format of your dates to standard DATE or DATETIME *would*
be a sensible thing to do :)
--
Jason Wong
Gremlins Associates
www.gremlins.com.hk