Skip to content

Instantly share code, notes, and snippets.

@barrykooij
Created December 2, 2014 18:22
Show Gist options
  • Save barrykooij/f162f1686de1e16e9234 to your computer and use it in GitHub Desktop.
Save barrykooij/f162f1686de1e16e9234 to your computer and use it in GitHub Desktop.
<?php
for ( $i = 1; $i < 13; $i ++ ) {
$N = date( 'N', strtotime( '01-' . $i . '-2015' ) );
$d=1;
if ( $N > 1 ) {
$d = ( 7 - $N ) + 2;
}
$first_monday = strtotime( $d . '-' . $i . '-2015' );
var_dump( date( 'd-m-Y', $first_monday ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment