inherit
130193
0
Nov 26, 2020 18:16:26 GMT -8
Ginger
124
August 2008
gingerfrost
|
Post by Ginger on May 13, 2014 15:39:50 GMT -8
This probably sounds extremely crazy, but...
Can I have a clock script that basically counts up on a share live time, that I can edit the Days/time?
I don't want it to be connected to the forum, it has to be by itself....
I just basically want this code except with a different line than "var today=new Date(00:0;00:00);" so it doesn't pull the information and I can edit exactly what time the live clock starts counting on everyone's page.
//Umm basically can I have a Countdown that actually Counts up? that I can easily edit?//
<script> function startTime() { var today=new Date(00:0;00:00); var h=today.getHours(); var m=today.getMinutes(); var s=today.getSeconds(); m = checkTime(m); s = checkTime(s); document.getElementById('txt').innerHTML = h+":"+m+":"+s; var t = setTimeout(function(){startTime()},3500); }
function checkTime(i) { if (i<10) {i = "0" + i}; // add zero in front of numbers < 10 return i; } </script>
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on May 14, 2014 12:46:37 GMT -8
A countdown that counts up would only work on a date from the past. You just want to figure out how long from a specific date/time it has been ?
|
|
inherit
130193
0
Nov 26, 2020 18:16:26 GMT -8
Ginger
124
August 2008
gingerfrost
|
Post by Ginger on May 14, 2014 16:39:42 GMT -8
Well you basically summarized my blabber mess above.
A countdown(that counts count up after 0), that I can set/customize with CSS. However moves slower than the normal clock, like seconds take long enough that 1 day takes a week.
Sorry wormo for creating this extremely odd and possibly even stupid request.
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Jun 29, 2014 22:28:36 GMT -8
Gingersorry this took so long. I forgot about this thread. you can always tag if something seems like it might have been forgotten try this: <timespot class="timer" month="3" date="10"></timespot><br> <timespot class="timer" month="4" date="20" year="2012"></timespot><br> <timespot class="timer" month="10" date="1" year="2000" hour="12" minute="0" second="0"></timespot>
<script type="text/javascript"> // slow down timer // by Wormopolis
var timeSlowFactor=7; //number of days it takes to advance one day
function convertTimes() { $('timespot.timer').each(function(){ if ($(this).attr('timestamp')) { var currtime=new Date() var pasttime=new Date(parseInt($(this).attr('timestamp'))); var elapsetime=currtime-pasttime; var modtime=parseInt(elapsetime/timeSlowFactor); var newtime=new Date(pasttime.getTime()+modtime); $(this).html(newtime.toLocaleString()); } }); window.setTimeout(convertTimes,(1000*timeSlowFactor)); }
$(document).ready(function(){ $('timespot.timer').each(function(){ var tstdate=new Date(); var vicdate=new Date(); if (parseInt($(this).attr('month')) && parseInt($(this).attr('date'))) { vicdate.setMonth(parseInt($(this).attr('month'))-1); vicdate.setDate(parseInt($(this).attr('date'))); if (parseInt($(this).attr('year'))) vicdate.setFullYear(parseInt($(this).attr('year'))); if (parseInt($(this).attr('hour'))) vicdate.setHours(parseInt($(this).attr('hour'))); if (parseInt($(this).attr('minute'))) vicdate.setMinutes(parseInt($(this).attr('minute'))); if (parseInt($(this).attr('second'))) vicdate.setSeconds(parseInt($(this).attr('second'))); $(this).attr('timestamp',vicdate.getTime()); } }); convertTimes(); }); </script>
you can put the <timespot> elements wherever you want them to show up. they have class "timer" for CSS. the only variable is the timeSlowFactor which slows down time the higher it goes, and speeds up time if it is less then 1. if you set it to a negative number, it will actually reverse the clock. keep in mind there is no proofing in this. if you type an invalid month or date or any data, it will do whatever it thinks needs to be done with it. so dont TRY and break it, because it will break. It only really works on past dates like you asked. if you try to put in a future date, it will break it.
|
|
inherit
130193
0
Nov 26, 2020 18:16:26 GMT -8
Ginger
124
August 2008
gingerfrost
|
Post by Ginger on Jul 20, 2014 14:45:17 GMT -8
Holy crap, I totally forgot about this thread...
Thank you matched everything I asked for.
|
|