Have you ever wanted to post something on your website, but have it disappear after a few days, or a couple weeks? This idea will help you not display content longer than needed. It also helps to not display outdated content.

Options include:

The following image will disappear on August 2, 2013, at midnight:



8/2/2013 to 8/3/2013

These are the relevant files...

<!-- CSS starts here -->
.DateRange, .DateDiv { display: none; text-align: center; }
<!-- CSS ends here -->


<!-- JavaScript starts here -->
$(function() {
$(".DateDiv").each(function(index) {
var sRange = $(this).find(".DateRange").html();
var arrTemp = sRange.split(" to ");
var dtFrom = new Date(arrTemp[0]);
var dtTo = new Date(arrTemp[1]);
var dtNow = new Date();
if (dtNow >= dtFrom && dtNow <= dtTo)
$(this).show();
});
});
<!-- JavaScript ends here -->


<!-- HTML starts here -->
<!-- Simply change the dates below to adjust your results -->
<div class="DateDiv">
<span class="DateRange">8/2/2013 to 8/3/2013</span>
<img src="img/button_home.png" width="250" height="252">
</div>
<!-- HTML ends here -->