Re: Last Friday of every month

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



VamVan wrote:
Can you tell me how to do this ?

suppose I have a date variable = '02/23/2008'

i need to know if this is the last friday of february....

let me know.

   $month = 3;
   $year = 2008;

for ($day = 31; $day >= 21; $day--) { // maximum of 7 days, but february starts at 28 $tmp_time = mktime(0, 0, 0, $month, $day, $year);

       if (date('w', $tmp_time) === '5') { // 5 = friday
return date('d-m-Y', $tmp_time); // return $day.'-'.$month.'-'.$year; // without the function it is faster off course
           // echo 'Yeah, friday!';
       }
   }

Something similar worked for me to find out when daylight saving time is.
--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other....'/

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux