Skip to content

Instantly share code, notes, and snippets.

@simplethemes
Created July 30, 2014 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simplethemes/ab03bc25332cf7f9172c to your computer and use it in GitHub Desktop.
Save simplethemes/ab03bc25332cf7f9172c to your computer and use it in GitHub Desktop.
Live Services
<?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