Skip to content

Instantly share code, notes, and snippets.

@ericjsilva
Last active December 19, 2015 19:59
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 ericjsilva/6010423 to your computer and use it in GitHub Desktop.
Save ericjsilva/6010423 to your computer and use it in GitHub Desktop.
Created this script after seeing a post about October having 5 Mondays, 5 Tuesdays, and 5 Wednesdays and it was the first time it would occur in 400 years or something stupid like that. The script starts at the current year and decrements down to the $endYear value and will print out all years in which October has 5 Mondays, Tuesdays, and Wednes…
<?php
function checkOctober() {
$endYear = 1800;
$currentYear = intval(date("Y"));
for ($i = $currentYear; $i >= $endYear; $i--) {
$d = strtotime("01 October ".$i);
$w = date("w", $d);
if ($w == 1) {
echo date("Y", $d) . "<br/>";
}
}
}
function determineIfFirstIsMonday($y) {
}
?>
<html>
<title>October 1st Test</title>
<body>
<h1>October 1st Test</h1>
<p>The following years had October 1st occurring on a Monday.</p>
<p>This means that there were 5 Mondays, 5 Tuesdays, and 5
Wednesdays in the month of October that year.</p>
<?php checkOctober(); ?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment