You could also do: $daystosubtract = 3; $mydate = (date("m/d/y",mktime(0,0,0,date("m"),date("d")-$daystosubtract,date("Y")))); Jeremy Schreckhise "Jason Barnett" <jason.barnett@xxxxxxxxxxxxx> wrote in message news:20050131172952.61088.qmail@xxxxxxxxxxxxxxxx > Ron Herhuth wrote: > > I am trying to construct a function where I feed it a number such as "x" > > it returns the date "x" days ago. > > <?php > > $format = 'l dS of F Y h:i:s A'; > > /** Check that "now" relative time is ok, instead of midnight */ > echo date($format, strtotime("now")) . "\n"; > > /** If now resolves correctly, then this should work */ > $x = strtotime("-1 days"); > echo date($format, $x); > > ?> > > > > > I tried checking out several resources that give you the difference > > between two dates, but not exactly what I was looking for. I was just > > hoping someone had a little algorithm in their bag of tricks. > > > > Thanks, > > Ron > > > > > -- > Teach a man to fish... > > NEW? | http://www.catb.org/~esr/faqs/smart-questions.html > STFA | http://marc.theaimsgroup.com/?l=php-general&w=2 > STFM | http://www.php.net/manual/en/index.php > STFW | http://www.google.com/search?q=php > LAZY | > http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php