Entry
How can I find out what the date of the last monday was without year/month concerns?
May 31st, 2000 09:11
Nathan Wallace, Bill Pargeter, Dave Mitchell, Richard Lynch
The following _should_ determine the date of the last Monday (or today,
if today's Monday):
$MonDate = mktime(0,0,0,
(int)date("m"),
(int)date("j") - (((int)date("w") + 6) % 7),
(int)date("Y"));
The principle is to use the 'day of week' to offset the 'day of month'
and let mktime() do the rest.
You might prefer to try this:
$now = time();
while (date('D', $now) != 'Mon'){
$now -= 60*60*24;
}
echo date("D m/d/Y", $now);