note 75863 deleted from function.date by tularis

From: Date: Thu, 09 Feb 2012 21:02:24 +0000
Subject: note 75863 deleted from function.date by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-186015@lists.php.net to get a copy of this message
Note Submitter: jcwebb at dicoe dot com ---- i needed the day (eg. 27th) of the last Monday of a month <?php $d=cal_days_in_month(CAL_GREGORIAN,$m,$y); // days in month if (date('l',mktime(0,0,0,$m,$d,$y))=='Monday'): $finalmonday=$d; else: $finalmonday=date('d',strtotime('last Monday',mktime(0,0,0,$m,$d,$y))); // day(date) of last monday of month, eg 26 endif; ?> this also works... <?php $finalmonday=date('d',strtotime('last Monday',mktime(0,0,0,$m,($d+1),$y))); //the '$d+1' is to catch the last day IS a monday (eg. dec 2007) ?> Hope it helps, BigJonMX

« previous php.notes (#186015) next »