algorithm Posted June 8, 2010 Share Posted June 8, 2010 How do I, given a month and a year, find something like the 2nd friday of that month. Or find the last wednesday? Quote Link to comment Share on other sites More sharing options...
ignace Posted June 8, 2010 Share Posted June 8, 2010 $secondFriday = strtotime('second friday'); $lastWednesday = strtotime('last wednesday'); For more info see: http://www.php.net/manual/en/datetime.formats.relative.php Quote Link to comment Share on other sites More sharing options...
jskywalker Posted June 8, 2010 Share Posted June 8, 2010 echo date("d-m-y",strtotime("last day jun 2010")) it echos "31-05-10" on my system..... I always thought June was the 6th month....? Quote Link to comment Share on other sites More sharing options...
dabaR Posted June 9, 2010 Share Posted June 9, 2010 Hah. I totally thought June was the sixth month too. But then again, $a[5] is the sixth element of $a. Sometimes strtotime does not work as you would like it to. The link Ignace pointed to is really good. I came up with this example: <?php echo date('Y-m-d', strtotime('second thursday', strtotime('June 2010'))); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.