Playing With Dates?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
djlex1928
Forum Commoner
Posts: 31
Joined: Sun Sep 19, 2010 3:23 pm

Playing With Dates?

Post 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
?>
s992
Forum Contributor
Posts: 124
Joined: Wed Oct 27, 2010 3:06 pm

Re: Playing With Dates?

Post by s992 »

szabizs
Forum Newbie
Posts: 2
Joined: Sat Nov 27, 2010 5:33 am

Re: Playing With Dates?

Post 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" ));
Post Reply