Skip to content

Instantly share code, notes, and snippets.

@danemorgan
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save danemorgan/9255319 to your computer and use it in GitHub Desktop.

Select an option

Save danemorgan/9255319 to your computer and use it in GitHub Desktop.
is_last_week() function for determining if the current date is in the last seven days of the current month.
<?php
include ('is_last_week.php');
if ( is_last_week() ) :
echo 'We are in the last week of the month';
else :
echo 'We havent reached the last week yet this month.';
endif;
<?php
$last_week = false;
function is_last_week() {
$days_left = date('t') - date('j');
if ( 7 > $days_left ) :
$last_week = true;
endif;
return $last_week;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment