Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Do something between exact two dates in PHP
$showDate = "2019-07-16 20:00:00.0";
$hideDate = "2019-07-22 20:00:00.0";
$timezone = new DateTimeZone('Europe/Warsaw');
$now = new DateTime();
// If in timeframe
if( $now > new DateTime($showDate, $timezone) && $now < new DateTime($hideDate, $timezone) ) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment