Re: $mydata->StampDate

From: Date: Mon, 27 Jun 2005 04:08:24 +0000
Subject: Re: $mydata->StampDate
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-217672@lists.php.net to get a copy of this message
John Taylor-Johnston wrote: > I created my own counter. I have a varchar (10) field that resembles a > date: 2005-06-26. Now I would like to parse out $mydata->StampDate to > find how many hits per day I have had since "2003-08-23". Where do I start? > > while ($mydata = mysql_fetch_object($news)) > { > } You can use strtotime() to convert your string date to a PHP date. and then calculate it from that. However, I'd strongly recommend using a real MySQL date field to store the date. There's no reason not to, and then you can use MySQL native functions to do a lot of the calculation. Jasper

« previous php.general (#217672) next »