1

I need to display the date of Tuesday for this week, next week, and the week after that.

For example,

$first_date = date('m/d/y',strtotime('tuesday this week'));  =>result => '01/10/13'

$second_date = date('m/d/y',strtotime('tuesday next week'));  =>result => '08/10/13'

$third_date = -----This one i needed--------  =>result => '15/10/13'
mangala
  • 143
  • 1
  • 2
  • 13

3 Answers3

2

Try this:

$third_date = date('m/d/y',strtotime('tuesday +2 week'));

Online example:

http://sandbox.onlinephpfunctions.com/code/bd9189f69add69490cb0254c23ada04a24355338

Joran Den Houting
  • 3,149
  • 3
  • 21
  • 51
1

The third Tuesday from Tuesday this week can be found like this:-

$date = new \DateTime();
$date->setISODate($date->format('o'), $date->format('W'), 2);
$date->add(new \DateInterval('P3W'));

Although it isn't 100% clear that that is what you want.

vascowhite
  • 18,120
  • 9
  • 61
  • 77
0
$third_date = date('m/d/y', strtotime($second_date . ' + 7 days'));

Based on the fact that $second_date is on a tuesday, then second date plus 7 days will be also on a tuesday.

Cristian Bitoi
  • 1,557
  • 1
  • 10
  • 14