-1

I Have Current date. Ho to find Date After 3 Days. I am Using CodeIgniter My Controller is -

public function index()
{
    date_default_timezone_set('Asia/Kolkata');
    $Curr_Date = date('Y/m/d');
    $today_dt = new DateTime($Curr_Date);
}
devendra
  • 137
  • 2
  • 16
  • Checkout the [modify](http://php.net/manual/en/datetime.modify.php) method of DateTime. – Jonnix Sep 14 '16 at 14:08
  • I disagree on the duplicate, as that thread is over 6 years old and demonstrates outdated methods. Only at the very bottom do you find the recommended way of doing it, namely with DateTime's `add()` method. – ChristianF Sep 14 '16 at 14:19
  • Sorry Shaktimaan. – devendra Sep 14 '16 at 14:24

2 Answers2

1
$newDate = new DateTime(strtotime("+3 days"));

i think this may help you...

Klajdi Dosti
  • 174
  • 2
  • 13
0

Pretty straight forward. You can do this using the DateTime class:

public function index()
{
    date_default_timezone_set('Asia/Kolkata');
    $today_dt = new DateTime();
    $in3days = new DateTime();
    $in3days->add(new DateTimeInterval("PD3"));
}

or you can use strtotime

$in3days = new DateTime(strtotime("+3 days"));
Styphon
  • 10,304
  • 9
  • 52
  • 86