0

Okay, so I have a predefined date getting pulled from a database that looks like this: 2014-06-17 and I need to add 60 days to that specified day.

My code is as below: but it currently echoes out the same day for both result and accept.

What is wrong?

$result = $this->employment->verify($data);

        echo $result.'<br/>';

        $accept = date('Y-m-d', strtotime("+60 days", $result));

        echo $accept.'<br/>';

        return false;
user3758114
  • 47
  • 2
  • 7

3 Answers3

1

strtotime needs a UNIX timestamp as the second argument:

$accept = date('Y-m-d', strtotime("+60 days", strtotime($result)));
AbraCadaver
  • 78,200
  • 7
  • 66
  • 87
1
$result ='2014-06-17';

$accept = date('Y-m-d', strtotime($result. ' + 60 days'));

echo $accept;

That should work, I hope.

0
<?php
$result ='2014-06-17';

echo $result.'<br/>';

$accept = date('Y-m-d', strtotime("+60 days", strtotime($result)));

echo $accept.'<br/>';

demo: http://codepad.viper-7.com/rQVnmB