Created
July 30, 2014 23:07
-
-
Save simplethemes/ab03bc25332cf7f9172c to your computer and use it in GitHub Desktop.
Live Services
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 | |
$start = "11:00 am"; | |
$end = "12:30 pm"; | |
$current_time = date('h:i a'); | |
$date1 = DateTime::createFromFormat('h:i a', $current_time); | |
$date2 = DateTime::createFromFormat('h:i a', $start); | |
$date3 = DateTime::createFromFormat('h:i a', $end); | |
$is_weekend = (date('l') == "Saturday" || date('l') == "Sunday") ? true : false ; // true if Saturday or Sunday | |
if ($date1 > $date2 && $date1 < $date3 && $is_weekend) | |
{ | |
echo '<video width="320" height="240" controls></video>'; | |
} else { | |
echo '<img src="http://placehold.it/320x240/EEE/CCC&text=offline"/>'; | |
} | |
//Debug: | |
var_dump($date1).'<br />'.var_dump($date2).'<br />'.var_dump($date3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment