Last active
August 29, 2015 13:56
-
-
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.
This file contains hidden or 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 | |
| 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; |
This file contains hidden or 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 | |
| $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