Skip to content

Instantly share code, notes, and snippets.

@anthonycole
Created July 27, 2013 07:00
Show Gist options
  • Save anthonycole/6094052 to your computer and use it in GitHub Desktop.
Save anthonycole/6094052 to your computer and use it in GitHub Desktop.
#doesntwork
<?php
$year = date("Y");
// if the curret time is after november 31 but before the 31st of march, eot = 31st of march
$decemberstart = strtotime("1 December " + $year);
$marchend = strtotime("31 March " + $year);
// if the current time is after 1 april but before 31 july, eot = 31 july
$aprilstart = strtotime("1 April " + $year);
$julyend = strtotime("31 July " + $year);
// if the current time is after 1 august but before 31 november, eot = 31 novmeber
$auguststart = strtotime("1 August " + $year);
$decemberend = strtotime("31 November " + $year);
$user_ts = time();
// 3 months
if(($user_ts >= $decemberstart) && ($user_ts <= $marchend)) {
$eot = $marchend;
}
if(($user_ts >= $aprilstart) && ($user_ts <= $julyend)) {
$eot = $julyend;
}
if(($user_ts >= $auguststart) && ($user_ts <= $decemberend)) {
$eot = $decemberend;
}
echo $eot;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment