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? Link to comment https://forums.phpfreaks.com/topic/204201-getting-specific-dates-in-a-month/ 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 Link to comment https://forums.phpfreaks.com/topic/204201-getting-specific-dates-in-a-month/#findComment-1069544 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....? Link to comment https://forums.phpfreaks.com/topic/204201-getting-specific-dates-in-a-month/#findComment-1069559 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'))); ?> Link to comment https://forums.phpfreaks.com/topic/204201-getting-specific-dates-in-a-month/#findComment-1069767 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.