1<!DOCTYPE HTML>
2<html>
3<head>
4<meta name="viewport" content="width=device-width, initial-scale=1">
5<style>
6p {
7 text-align: center;
8 font-size: 60px;
9 margin-top: 0px;
10}
11</style>
12</head>
13<body>
14
15<p id="demo"></p>
16
17<script>
18// Set the date we're counting down to
19var countDownDate = new Date("Jan 5, 2021 15:37:25").getTime();
20
21// Update the count down every 1 second
22var x = setInterval(function() {
23
24 // Get today's date and time
25 var now = new Date().getTime();
26
27 // Find the distance between now and the count down date
28 var distance = countDownDate - now;
29
30 // Time calculations for days, hours, minutes and seconds
31 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
32 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
33 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
34 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
35
36 // Output the result in an element with id="demo"
37 document.getElementById("demo").innerHTML = days + "d " + hours + "h "
38 + minutes + "m " + seconds + "s ";
39
40 // If the count down is over, write some text
41 if (distance < 0) {
42 clearInterval(x);
43 document.getElementById("demo").innerHTML = "EXPIRED";
44 }
45}, 1000);
46</script>
47
48</body>
49</html>
50
1<p>Open from <time>10:00</time> to <time>21:00</time> every weekday.</p>
2<p>I have a date on <time datetime="2008-02-14 20:00">Valentines day</time>.</p>
1// date part ///
2var month=x.getMonth()+1;
3var day=x.getDate();
4var year=x.getFullYear();
5if (month <10 ){month='0' + month;}
6if (day <10 ){day='0' + day;}
7var x3= month+'-'+day+'-'+year;
8
9// time part //
10var hour=x.getHours();
11var minute=x.getMinutes();
12var second=x.getSeconds();
13if(hour <10 ){hour='0'+hour;}
14if(minute <10 ) {minute='0' + minute; }
15var x3 = x3 + ' ' + hour+':'+minute+':'+second
16
17<span id='ct4' style="background-color:#FFFF00"></span>
18
1<!DOCTYPE html>
2<html>
3<body>
4
5<h1>The time element</h1>
6
7<p>Open from <time>10:00</time> to <time>21:00</time> every weekday.</p>
8
9<p>I have a date on <time datetime="2008-02-14 20:00">Valentines day</time>.</p>
10
11<p><b>Note:</b> The time element does not render as anything special in any of the major browsers.</p>
12
13</body>
14</html>