Jump to content


Photo

dates


  • Please log in to reply
1 reply to this topic

#1 Woodburn2006

Woodburn2006
  • Members
  • PipPipPip
  • Advanced Member
  • 214 posts

Posted 14 September 2006 - 07:58 PM

if i have a variable with a number of days e.g. 20. is there any way of adding that number to a date so that we get a new date.

for example if i start with 2006/04/20 i would add 20 to it and end up with 2006/05/10.

is there any way of doing this?

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 14 September 2006 - 08:03 PM

<?php
$date = '2006/04/20';
$addDays = 20

echo date ('Y/m/d', strtotime ("$date + $addDays days"));

?>

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users