Results 1 to 11 of 11
Oct 16, 2011, 03:10 #1
- Join Date
- Dec 2004
- Yorkshire, England
- 0 Post(s)
- 0 Thread(s)
Generating a 'Y-m-d' value for the start of the previous week
I have some code that calculates the date for the beginning of the previous week.
date("Y-m-d", time() - (date('w') - 1) * (60 * 60 * 24))
Now, I have actually solved this problem.
$array_date = explode('-', date("Y-m-d", time() - (date('w') - 1) * (60 * 60 * 24)));
$array_search['start'] = date('Y-m-d', mktime(0, 0, 0, $array_date, $array_date - 1, $array_date));
So this is more out of curiosity than anything else, I'd just like to know what would need to be done to the first code sample to add on that extra day at the beginning.
I've tried everything I can think of, so any solution would be much appreciated!