Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Afficher la page qu'à partir d'une certaine date/heure
<?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
You can’t perform that action at this time.