Created
April 27, 2009 22:05
-
-
Save 1stvamp/102767 to your computer and use it in GitHub Desktop.
getNextFirstFriday() - Handy function for 2600 meeting websites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Handy function for 2600 meeting websites | |
/** | |
* Return a unix timestamp for next "first Friday of the month", e.g. | |
* either the first Friday of the current month or if that date has already passed | |
* the first friday of the next month | |
* @return int unix timestamp | |
*/ | |
function getNextFirstFriday() { | |
$firstFridayThisMonth = strtotime('first friday', mktime(0, 0, 0, date('n'), 0, date('Y'))); | |
if (time() < strtotime('7pm', $firstFridayThisMonth)) { | |
return $firstFridayThisMonth; | |
} | |
return strtotime('first friday', strtotime(date('Y-m-0', strtotime('next month')))); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment