Hi,

I just need to do the following date calculation:

2004-12-12 + 2 = 2004-12-14

thats all.

remember: 2004(year)-12(month)-2(day)
I just need to add days to a specific date. No the current date.

Even that is so simple I cant find nothing in the web. Theres a lot for calculte using the current date. Thats not what I need.

check this:

$timestamp = strtotime("+2 day");
$tomorrow=strftime( "%Y-%m-%d",$timestamp);

echo $tomorrow; / This give me the one day after the current day /

fe example: supost today is 2004-09-06 this will give me 2004-09-07

Thats nice, but what I want is to use instead of the current date, a specific date, any date I want.

    Try this:

    mktime(0, 0, 0, 12, 12 + 2, 2004);

    Joe

      Can you say something about this :
      mktime(0, 0, 0, 12, 12 + 2, 2004); ??

      I dont get it:

      this gives me a guess a timestamp date.

      Then How can I convert it to normal date: 2004-00-00 ??
      read again the first post.

      Thanks,.

        Not quite sure what you're after unless it's this:

        $today = mktime();
        $twodaystime = mktime() + (60*60*24*2);
        
        $today    = date('Y-m-d', $today);
        $twodaystime = date('Y-m-d', $twodaystime);

        If it's another date then convert it to a unix timestamp and do the same.

          I don't like 606024*2 for "two days", because it assumes that all days are 24 hours long. But then,

          $timestamp = strtotime("+2 day");
          $tomorrow=strftime("%Y-%m-%d",$timestamp);

          works for me, both that way and (as I'd tend to prefer) date('Y-m-d',strtotime('+2 days')).

          I'm going to go wild here and suspect that mysticav has a string that contains a date of the form "Y-m-d", and wants to get back a string in the same form for the date two days later.

          $date = '2004-07-15';
          echo date('Y-m-d',strtotime($date.' +2 days'));

            Write a Reply...