note 75863 added to function.date

From: Date: Tue, 19 Jun 2007 17:48:55 +0000
Subject: note 75863 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-127793@lists.php.net to get a copy of this message
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 ---- Server IP: 80.64.47.13 Probable Submitter: 88.19.27.43 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/75863 Del: integrated -- https://master.php.net/note/delete/75863/integrated Del: useless -- https://master.php.net/note/delete/75863/useless Del: bad code -- https://master.php.net/note/delete/75863/bad+code Del: spam -- https://master.php.net/note/delete/75863/spam Del: non-english -- https://master.php.net/note/delete/75863/non-english Del: in docs -- https://master.php.net/note/delete/75863/in+docs Del: other reasons-- https://master.php.net/note/delete/75863 Reject -- https://master.php.net/note/reject/75863 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127793) next »