last week, this week (php)

TDSii picture TDSii · Apr 19, 2011 · Viewed 28.3k times · Source

i am making some statistics, i want to select the time from (last week only) and this week.

for this week its easy:

$start = strtotime('this week');
$finish = time();

for last week

$start = strtotime('last week');
$finish = ??????

Answer

Jonah picture Jonah · Apr 19, 2011

This?

$start = strtotime('2 weeks ago');
$finish = strtotime('last week');

Edit: change credit to @Dominic Barnes's comment.