Skip to content

Instantly share code, notes, and snippets.

@1stvamp
Created April 27, 2009 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1stvamp/102767 to your computer and use it in GitHub Desktop.
Save 1stvamp/102767 to your computer and use it in GitHub Desktop.
getNextFirstFriday() - Handy function for 2600 meeting websites
<?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