Page 1 of 1

Playing With Dates?

Posted: Sat Nov 27, 2010 8:55 am
by djlex1928
Hi,

Just wondering if there is a standard PHP function to acheive the following, or do I need to write a lengthy function myself?

Code: Select all

<?php
$datebefore = "2010-11-28";
$dateafter = imaginaryfunction($datebefore, 7); //Adds 7 days to the date
echo $dateafter; //Output: 2010-12-05
?>

Re: Playing With Dates?

Posted: Sat Nov 27, 2010 1:36 pm
by s992

Re: Playing With Dates?

Posted: Sun Nov 28, 2010 12:43 pm
by szabizs
Mmm, just today did something like this :)

Code: Select all

  $con = "SELECT * FROM yourTable";
  $result = mysql_query($con) or die(mysql_error());

  $t1 =   date("Y-m-d", strtotime($row['ts'] ."+7 days" ));