Jump to content


Photo

Date Calculation


  • Please log in to reply
4 replies to this topic

#1 paulspoon

paulspoon
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 13 July 2006 - 01:19 PM

I've got the following :

$grvdate = date("Y-m-d");

How can I subtract three days from todays date and use it in a further query ?

Regards


#2 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 13 July 2006 - 01:21 PM

$tomorrow  = mktime(0, 0, 0, date("m")  , date("d")-3, date("Y"));


#3 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 13 July 2006 - 01:22 PM

check the date() function http://www.phpfreaks...ction.date.html

#4 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 13 July 2006 - 01:23 PM

date("Y-m-d",mktime(0,0,0,date("m"),date("d")-3,date("Y")));

EDIT: Beaten to it!

#5 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 13 July 2006 - 01:23 PM

You can use:
<?php $threedaysago = date("Y-m-d",strtotime("-3 days")); ?>

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users