Prodigal Son Posted September 24, 2008 Share Posted September 24, 2008 Anyone know how I can grab the date of the current Monday? So if it were today, the date for Monday I would want is the 22nd. Link to comment https://forums.phpfreaks.com/topic/125700-solved-grab-the-current-date-for-monday/ Share on other sites More sharing options...
Barand Posted September 24, 2008 Share Posted September 24, 2008 <?php $dow = date('w'); $offset = ($dow+6)%7; $mon = date('Y-m-d', strtotime("-$offset days")); echo $mon; ?> Link to comment https://forums.phpfreaks.com/topic/125700-solved-grab-the-current-date-for-monday/#findComment-649954 Share on other sites More sharing options...
rarebit Posted September 24, 2008 Share Posted September 24, 2008 was on phone, so Barand beat me to it, also his is more efficient... <?php $d = date("w"); // 0 (for Sunday) through 6 (for Saturday) if($d!=1) { $d = $d - 1; $d = time() - (86400*$d); } echo "Mon: ".date('d', $d); ?> Link to comment https://forums.phpfreaks.com/topic/125700-solved-grab-the-current-date-for-monday/#findComment-649959 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.