I am trying to build an algorithm that will essentially do this:
Code: [Select]$this_month = October
$third_sunday = CalculateThirdSunday(October)
if ( ( TodaysDate before $third_sunday ) | ( TodaysDate == $third_sunday )
do something
else CalculateThirdSunday(November)
do something else
So the sorta pseudo-code above should reveal that I want a function that will always take the current month and calculate the third Sunday. Then if it's on or before that third sunday do something. However if it is after the the third Sunday, then we will calculate the third sunday of next month and then do something.
I can calculate what the third sunday out from now() is quite trivially:
<?PHP echo date('l jS F (Y-m-d)', strtotime('third Sunday')); ?>
But anyone got any idea how to find the third sunday from the beginning of the month? I tried something like
<?PHP echo date('l jS F (Y-m-d)', strtotime('2009-10-01 +third Sunday')); ?>
but that appears to not work. It tells me the next sunday is in Feb
help with contest script
I would like to code a contest script to my site but i don't know how. Could someone just give me push in the right direction?
Looping Problem
I've got a client that has a database with about 200 events at any given time. I'm trying to loop through the dates based on a form and show the title of the event if the start date of the form
How do I create a 2D game "camera" to follow player?
In J2ME programming I'm targeting MIDP 2.0 devices.I'm using gamecanvas and I was thinking that I could create my full world (640 x 480) using a TiledLayer and then set the refpixel of the TilerLayer
Creating a db with a query
Hello everyone.I'm having troubles creating a db with a query.I'm reading a book called PHP Bibles from Tim Converse I get this errorFatal error: Call to undefined function mysql_create_db() in
Sending a hyperlink through mail
HI all,
Select Lists into MYSQL
Hello All, I am new to PHP @ 1 week. So borrowing code anywhere I can. I am making progress, but hit a snag. I have 2 list boxes, that I use to move items left to right. When I click submit I want
How to show the difference between two data field in a database with php.
Hello php gurus,how r u all... i'm not so well facing a typical problem please help me...i'm working with php and mysql.my problem is...in a data base have two integer field like parent_id &
Javascript or not?
How many people prefer javascript/ajax sites? How many prefer the good old fashion straight php sites?
I need an iframe that calls up a different page according to the date
hiI don't know any php (only html) and I urgently need to do the following: I need an iframe that calls up a different page according to the date e.g. on the 2th Dec a page called 'special2.php',
DateTimeZone::listIdentifiers headache
http://php.net/manual/en/datetimezone.listidentifiers.phpSo the documentation states that one can get locales by using the above mentioned function. However what I am trying to do is get country