-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhensbeandue.html
93 lines (77 loc) · 2.56 KB
/
whensbeandue.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<html>
<head>
<title>When's Bean due?</title>
</head>
<script type="text/javascript">
//######################################################################################
// Author: ricocheting.com
// Version: v2.0
// Date: 2011-03-31
// Description: displays the amount of time until the "dateFuture" entered below.
// NOTE: the month entered must be one less than current month. ie; 0=January, 11=December
// NOTE: the hour is in 24 hour format. 0=12am, 15=3pm etc
// format: dateFuture1 = new Date(year,month-1,day,hour,min,sec)
// example: dateFuture1 = new Date(2003,03,26,14,15,00) = April 26, 2003 - 2:15:00 pm
dateFuture1 = new Date(2011,9,2,12,0,0);
// TESTING: comment out the line below to print out the "dateFuture" for testing purposes
//document.write(dateFuture +"<br />");
//###################################
//nothing beyond this point
function GetCount(ddate,iid){
dateNow = new Date(); //grab current date
amount = ddate.getTime() - dateNow.getTime(); //calc milliseconds between dates
delete dateNow;
// if time is already past
if(amount < 0){
document.getElementById(iid).innerHTML="Now!";
}
// else date is still good
else{
days=0;hours=0;mins=0;secs=0;out="";
ms = (""+((amount%1000)+1000)).substr(1,3); amount = Math.floor(amount/1000);//kill the "milliseconds" so just secs
days=Math.floor(amount/86400);//days
amount=amount%86400;
hours=Math.floor(amount/3600);//hours
amount=amount%3600;
mins=Math.floor(amount/60);//minutes
amount=amount%60;
secs=Math.floor(amount);//seconds
if(days != 0){out += days +" "+((days==1)?"day":"days")+", ";}
if(hours != 0){out += hours +" "+((hours==1)?"hour":"hours")+", ";}
out += mins +" "+((mins==1)?"min":"mins")+", ";
out += secs +("."+ms)+" "+((secs==1)?"sec":"secs")+", ";
out = out.substr(0,out.length-2);
document.getElementById(iid).innerHTML=out;
setTimeout(function(){GetCount(ddate,iid)}, 25);
}
}
window.onload=function(){
GetCount(dateFuture1, 'countbox1');
};
</script>
<style type="text/css">
body {
margin-top: 1.0em;
background-color: #e3e3e3;
font-family: Helvetica, Arial, FreeSans, san-serif;
color: #000000;
}
h1 {
font-size: 3.8em;
color: #302e5f;
text-shadow: -1px -1px #333,1px 1px #FFF;
margin-bottom: 3px;
font-family: Helvetica Neue, Helvetica, Arial;
font-weight: 300;}
h1 a { text-decoration: none }
#countbox1 {color: #ff3025; font-weight: 900;}
</style>
<body>
<center>
<h1> </h1>
<h1>When's Bean due?</h1>
<hr width="75%"/>
<h1><div id="countbox1"></div></h1>
</center>
</body>
</html