RE: Last Friday of every month

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

 



> -----Original Message-----
> From: VamVan [mailto:vamseevan@xxxxxxxxx]
> Sent: Thursday, March 13, 2008 9:13 PM
> To: php-general@xxxxxxxxxxxxx
> Subject:  Last Friday of every month
> 
> 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.

My view...

$strDate = '02/23/2008';
//
$intDate = strtotime($strDate);
$numDaysInMonth = date('t', $intDate);
$dayOfWeek = date('w', $intDate);
$dayOfMonth = date('j', $intDate);
If ($dayOfWeek == 5 && $numDaysInMonth - $dayOfMonth < 7) {
	echo "Friday Party!";
} else {
	echo "Sorry dude, you missed it";
}

Btw, read the manual (and don't think to be so lucky to not found any bugs in my
code).

Regards,

Rob(inet)


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4296 | FAX 954-337-2695 | 
Email: info@xxxxxxxxxxxxx  | MSN Chat: best@xxxxxxxxxxxxx  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[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