Difference between revisions of "WCPatriotHousing"
From PDD Wiki
m (Protected "WCPatriotHousing" [edit=sysop:move=sysop]) |
|||
Line 1: | Line 1: | ||
+ | <addhtml> | ||
+ | <style type="text/css"> | ||
+ | #countdown { | ||
+ | font-family:Helvetica,Arial,Sans Serif; | ||
+ | font-size:2em; | ||
+ | font-weight:bold; | ||
+ | } | ||
+ | </style> | ||
+ | <span id="countdown"></span> | ||
+ | <script type="text/javascript"> | ||
+ | // set the date we're counting down to | ||
+ | var target_date = new Date("Nov 30, 2013").getTime(); | ||
+ | var dst_change_datetime = new Date("Nov 3, 2013 2:00"); | ||
+ | var today = new Date(); | ||
+ | if (today < dst_change_datetime) { | ||
+ | var target_date = new Date("Nov 29, 2013 23:00").getTime(); | ||
+ | } | ||
+ | // variables for time units | ||
+ | var days, hours, minutes, seconds; | ||
+ | // get tag element | ||
+ | var countdown = document.getElementById("countdown"); | ||
+ | // update the tag with id "countdown" every 1 second | ||
+ | setInterval(function () { | ||
+ | // find the amount of "seconds" between now and target | ||
+ | var current_date = new Date().getTime(); | ||
+ | var seconds_left = (target_date - current_date) / 1000; | ||
+ | // do some time calculations | ||
+ | days = parseInt(seconds_left / 86400); | ||
+ | seconds_left = seconds_left % 86400; | ||
+ | hours = parseInt(seconds_left / 3600); | ||
+ | seconds_left = seconds_left % 3600; | ||
+ | minutes = parseInt(seconds_left / 60); | ||
+ | seconds = parseInt(seconds_left % 60); | ||
+ | // format countdown string + set tag value | ||
+ | countdown.innerHTML = days + "d, " + hours + "h, " | ||
+ | + minutes + "m, " + seconds + "s"; | ||
+ | }, 1000); | ||
+ | </script> | ||
+ | </addhtml> | ||
+ | |||
===UPCOMING EVENTS=== | ===UPCOMING EVENTS=== | ||
Revision as of 14:43, 27 August 2013
<addhtml> <style type="text/css">
- countdown {
font-family:Helvetica,Arial,Sans Serif; font-size:2em; font-weight:bold; } </style> <script type="text/javascript"> // set the date we're counting down to var target_date = new Date("Nov 30, 2013").getTime(); var dst_change_datetime = new Date("Nov 3, 2013 2:00"); var today = new Date(); if (today < dst_change_datetime) { var target_date = new Date("Nov 29, 2013 23:00").getTime(); } // variables for time units var days, hours, minutes, seconds; // get tag element var countdown = document.getElementById("countdown"); // update the tag with id "countdown" every 1 second setInterval(function () {
// find the amount of "seconds" between now and target var current_date = new Date().getTime(); var seconds_left = (target_date - current_date) / 1000; // do some time calculations days = parseInt(seconds_left / 86400); seconds_left = seconds_left % 86400; hours = parseInt(seconds_left / 3600); seconds_left = seconds_left % 3600; minutes = parseInt(seconds_left / 60); seconds = parseInt(seconds_left % 60); // format countdown string + set tag value countdown.innerHTML = days + "d, " + hours + "h, " + minutes + "m, " + seconds + "s";
}, 1000); </script> </addhtml>