Skip to content

Instantly share code, notes, and snippets.

@chadsten
Created July 16, 2013 18:57
Show Gist options
  • Select an option

  • Save chadsten/6011544 to your computer and use it in GitHub Desktop.

Select an option

Save chadsten/6011544 to your computer and use it in GitHub Desktop.
<?
#$case = "2013-07-17 18:15:00 to 2013-07-19 18:15:00";
$case = "2013-07-25 18:15:00 to 2013-07-25 19:15:00";
#$case = "2013-07-24 19:00:00";
#$case = "2013-07-28 14:00:00 to 2013-07-30 22:00:00";
$set = split(' to ', $case); // Split the to and from dates up first
foreach ($set as $item) {
$raw[] = split(' ',$item); // Split the time and date up
}
?>
<div class="date-time-wrapper date">
<span class="date-time date from"><?= $raw['0']['0']; ?></span>
<?php if ($raw['1']['0'] && $raw[0][0] != $raw[1][0]) { ?> <span class="separator"> - </span><span class="date-time date to"><?= $raw['1']['0']; ?></span> <?php } ?>
</div>
<div class="date-time-wrapper time">
<span class="date-time time from"><?= $raw['0']['1']; ?></span>
<?php if ($raw['1']['1']) { ?><span class="separator"> - </span><span class="date-time time to"><?= $raw['1']['1']; ?></span> <?php } ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment