Last active
May 1, 2018 13:42
-
-
Save LouLeGrain/db23addd3b543fbb3d0f1a59fce9bc9b to your computer and use it in GitHub Desktop.
[Comparaison de dates] Comparer si aujourd'hui est entre deux dates #PHP #Dates
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
public static function isVotingTime() | |
{ | |
$dateEnd = new DateTime("03/31/2019", new DateTimeZone('Europe/Paris')); | |
$dateEndRelative = new DateTime("03/31/2019 last day of +1 month", new DateTimeZone('Europe/Paris')); | |
//Pour avoir +1 mois pile, on peut avoir des incohérences selon le nombre de jours | |
$dateBeginningVote = new DateTime("03/19/2018", new DateTimeZone('Europe/Paris')); | |
$today = new DateTime("now", new DateTimeZone('Europe/Paris')); | |
if ($today > $dateBeginningVote && $today < $dateEndRelative) { | |
return true; | |
} else { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment