Bastien Koert wrote: > On Tue, Jul 28, 2009 at 10:43 AM, Miller, > Terion<tmiller@xxxxxxxxxxxxxxxxxxxx> wrote: >> >> >> On 7/28/09 9:40 AM, "Bastien Koert" <phpster@xxxxxxxxx> wrote: >> >> On Tue, Jul 28, 2009 at 10:34 AM, Bob McConnell<rvm@xxxxxxxxx> wrote: >>> From: Miller, Terion >>> On 7/28/09 8:35 AM, "Ashley Sheridan" <ash@xxxxxxxxxxxxxxxxxxxx> wrote: >>> >>>> $pastDays = strtotime("-30 days"); >>>> $date = date("d/m/y", $pastDays); >>>> >>>> Well I tried and got no results from my query and I know there >>>> results with date ranges in the last 30 days, I basically need >>>> to count backward from now() 30 days I thought strtotime() would >>>> work well..but the fields in the db are varchar not date fields >>>> they are all formatted the same though 00/00/00: >>> If the dates are really stored as varchar, you are doing a lexical >>> comparison on a field that is meaningless in that context. You will need >>> to break the string down somewhere and do three separate comparisons. >>> >>> Bob McConnell >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >> Teri, >> >> have you considered making the field a date/ datetime type? You could >> add the column, then copy the data over with a sql statement casting >> it to the correct date format you require and then drop the original >> column >> >> -- >> >> Bastien >> >> Cat, the other other white meat >> >> I don't think I can this data is being pulled from our county health site, so it comes in how they put it on their page (scraping here) and I'm grabbing it using regex. (and this is totally public info so it's legit-my employer tells me) >> >> >> > > Yep, if you are not in control of the data and are just screenscraping > a site, then you don't have too many choices. > Why? If you're scraping it then you can cast it into whatever form you want before you store it in the db. Scrape it, strtotime(), store it? -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php