Last active
April 8, 2016 16:11
-
-
Save Rudde/a8d9555dc2dbf325a00fef10f6561731 to your computer and use it in GitHub Desktop.
Gives first day of the first week of the current month
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 | |
/** | |
* Created by PhpStorm. | |
* User: Rudde | |
* Date: 01.04.2016 | |
* Time: 00.25 | |
*/ | |
function firstDayofFirstWeekinCurrentMonth($date = NULL) { | |
$date = is_null ($date) ? new DateTime('first day of this month') : $date->modify('first day of this month'); | |
$date->modify(('Sunday' == $date->format('l')) ? 'Monday last week' : 'Monday this week'); | |
return $date; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment