Re: [PHP] calculating US holidays
On Monday, April 15, 2002, at 03:17 PM, Tom Beidler wrote: I need to calculate the date to see if it's a holiday, i.e. is today presidents day No, today is Patriot's Day! Not sure if it's celebrated outside of Massachusetts Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calculating US holidays
? $month = date(m); $day = date(d); if ($month == 10 $day == 31) { print It's Halloween!; } ? you could do something similar to that. tyler - Original Message - From: Tom Beidler [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] Sent: Monday, April 15, 2002 2:17 PM Subject: [PHP] calculating US holidays I need to calculate the date to see if it's a holiday, i.e. is today presidents day, which happens to be the third monday of february. Can someone point me to some code that can do that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calculating US holidays
That's fine for fixed dates, and I have that figured out, but presidents day, memorial day, labor day and thanksgiving fall on different days each year. Presidents day is the third monday of February. How do I calculate that? From: Tyler Longren [EMAIL PROTECTED] Organization: Captain Jack Communications Date: Mon, 15 Apr 2002 14:48:15 -0500 To: Tom Beidler [EMAIL PROTECTED], php list [EMAIL PROTECTED] Subject: Re: [PHP] calculating US holidays ? $month = date(m); $day = date(d); if ($month == 10 $day == 31) { print It's Halloween!; } ? you could do something similar to that. tyler - Original Message - From: Tom Beidler [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] Sent: Monday, April 15, 2002 2:17 PM Subject: [PHP] calculating US holidays I need to calculate the date to see if it's a holiday, i.e. is today presidents day, which happens to be the third monday of february. Can someone point me to some code that can do that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calculating US holidays
He wants the third sunday in february which can't be handled by your code :) since the third sunday could fall on any number of days. The following isn't very optimal but will work (not syntax checked either). $i = 1; while( $i++ = 7 ) { // // First we find the first Sunday in February. // if( date( '%a', mktime( 0,0,0, 2,$i,2002 ) == 'Sun' ) { break; } } return date( '%s-%m-%Y', mktime( 0,0,0, 2,($i + 14),2002 ); Generalization of the above is left to you as an exercise *grin*. Cheers, Rob. - Tyler Longren wrote: ? $month = date(m); $day = date(d); if ($month == 10 $day == 31) { print It's Halloween!; } ? you could do something similar to that. tyler - Original Message - From: Tom Beidler [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] Sent: Monday, April 15, 2002 2:17 PM Subject: [PHP] calculating US holidays I need to calculate the date to see if it's a holiday, i.e. is today presidents day, which happens to be the third monday of february. Can someone point me to some code that can do that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calculating US holidays
You could port Date::Calc from perl... or just call a perl script to do the calculation. Probably the easiest way to figure out Easter (for the extreme example) that I can think of. -Steve On Monday, April 15, 2002, at 03:05 PM, Tom Beidler wrote: That's fine for fixed dates, and I have that figured out, but presidents day, memorial day, labor day and thanksgiving fall on different days each year. Presidents day is the third monday of February. How do I calculate that? From: Tyler Longren [EMAIL PROTECTED] Organization: Captain Jack Communications Date: Mon, 15 Apr 2002 14:48:15 -0500 To: Tom Beidler [EMAIL PROTECTED], php list [EMAIL PROTECTED] Subject: Re: [PHP] calculating US holidays ? $month = date(m); $day = date(d); if ($month == 10 $day == 31) { print It's Halloween!; } ? you could do something similar to that. tyler - Original Message - From: Tom Beidler [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] Sent: Monday, April 15, 2002 2:17 PM Subject: [PHP] calculating US holidays I need to calculate the date to see if it's a holiday, i.e. is today presidents day, which happens to be the third monday of february. Can someone point me to some code that can do that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calculating US holidays
Oh, I love these 32 second answers ;-) Just type it in google and zapp http://php.resourceindex.com/Functions_and_Classes/Date_and_Time/ 1st page, second answer ! G Oliver At 15.04.2002 13:05, you wrote: That's fine for fixed dates, and I have that figured out, but presidents day, memorial day, labor day and thanksgiving fall on different days each year. Presidents day is the third monday of February. How do I calculate that? From: Tyler Longren [EMAIL PROTECTED] Organization: Captain Jack Communications Date: Mon, 15 Apr 2002 14:48:15 -0500 To: Tom Beidler [EMAIL PROTECTED], php list [EMAIL PROTECTED] Subject: Re: [PHP] calculating US holidays ? $month = date(m); $day = date(d); if ($month == 10 $day == 31) { print It's Halloween!; } ? you could do something similar to that. tyler - Original Message - From: Tom Beidler [EMAIL PROTECTED] To: php list [EMAIL PROTECTED] Sent: Monday, April 15, 2002 2:17 PM Subject: [PHP] calculating US holidays I need to calculate the date to see if it's a holiday, i.e. is today presidents day, which happens to be the third monday of february. Can someone point me to some code that can do that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calculating US holidays OT
I need to calculate the date to see if it's a holiday, i.e. is today presidents day No, today is Patriot's Day! Not sure if it's celebrated outside of Massachusetts It's celebrated any day there's a SCUD inbound! =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calculating US holidays
Hi This is one way: echo date(d/m/Y,strtotime(third sunday,strtotime(2/1/2002))); Tom At 05:17 AM 16/04/2002, Tom Beidler wrote: I need to calculate the date to see if it's a holiday, i.e. is today presidents day, which happens to be the third monday of february. Can someone point me to some code that can do that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calculating US holidays
Hi Perhaps that should have been: echo date(d/m/Y,strtotime(third monday,strtotime(2/1/2002))); :-) Tom At 05:17 AM 16/04/2002, Tom Beidler wrote: I need to calculate the date to see if it's a holiday, i.e. is today presidents day, which happens to be the third monday of february. Can someone point me to some code that can do that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php