Skip to content

Instantly share code, notes, and snippets.

@seanmcn
Created December 3, 2014 05:35
Show Gist options
  • Save seanmcn/340eb2ed8f04156932a3 to your computer and use it in GitHub Desktop.
Save seanmcn/340eb2ed8f04156932a3 to your computer and use it in GitHub Desktop.

Revisions

  1. seanmcn created this gist Dec 3, 2014.
    23 changes: 23 additions & 0 deletions timeDifference.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    <?php
    /*
    * Author: Sean McNamara
    * Some legacy code from OTS
    */
    $tr_date = strtotime($options['tr_date']);
    $fest_date = strtotime($options['fest_date']);
    $games_date = strtotime($options['games_date']);

    $now = strtotime("now");


    $difference = $tr_date - $now;
    if ($difference < 0) { $difference = 0; }
    echo "<div class=\"countdown_container\"><div class=\"countdown_days\"><h2>Torch Relay</h2>". ceil($difference/60/60/24)."<em>days</em><br /><date>18th May 2012</date></div></div>";
    $difference = $fest_date - $now;
    if ($difference < 0) { $difference = 0; }
    echo "<div class=\"countdown_container\"><div class=\"countdown_days\"><h2>Festival Date</h2>". ceil($difference/60/60/24)."<em>days</em><br /><date>21st June 2012</date></div></div>";
    $difference = $games_date - $now;
    if ($difference < 0) { $difference = 0; }
    echo "<div class=\"countdown_container\"><div class=\"countdown_days\"><h2>Olympic Games</h2>". ceil($difference/60/60/24)."<em>days</em><br /><date>27th July 2012</date></div></div>";
    ?>
    <div class="olympic_date">Olympic Games {pyro:theme:image file="torch_icon.png"} <date>27th July - 12th August 2012</date></div>