Created
December 20, 2017 12:51
-
-
Save thierrypigot/b4cb3b4acb40abceccf56103338061ed to your computer and use it in GitHub Desktop.
Afficher la page qu'à partir d'une certaine date/heure
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 | |
date_default_timezone_set('UTC'); | |
$tz = 'Europe/Paris'; | |
$timestamp = time(); | |
$dt = new DateTime("now", new DateTimeZone($tz)); //first argument "must" be a string | |
$date = $dt->setTimestamp($timestamp); //adjust the object to correct timestamp | |
$date = $dt->format('Y-m-d H:i:s'); | |
$date = strtotime( $date ); | |
$date_mel = strtotime( '2017-11-07 20:30:00' ); | |
echo 'Date : '. $date .' / '. date( 'Y-m-d H:i:s', $date ) .'<br>'; | |
echo 'Date MEL : '. $date_mel .' / '. date( 'Y-m-d H:i:s', $date_mel ) .'<br>'; | |
if( $date < $date_mel ){ | |
echo 'Attente'; | |
}else{ | |
echo 'Go!'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment