Created
July 22, 2019 07:32
-
-
Save fedek6/c5b41c56863bf9b31816867899452cfd to your computer and use it in GitHub Desktop.
Do something between exact two dates in PHP
This file contains hidden or 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 | |
$showDate = "2019-07-16 20:00:00.0"; | |
$hideDate = "2019-07-22 20:00:00.0"; | |
$timezone = new DateTimeZone('Europe/Warsaw'); | |
$now = new DateTime(); | |
$now->setTimezone($timezone); | |
// If in timeframe | |
if( $now > new DateTime($showDate, $timezone) && $now < new DateTime($hideDate, $timezone) ) { | |
do_something(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment