Skip to content

Commit b40d831

Browse files
Merge pull request #50 from arpitghura/main
Added Realtime Date and Time Web App
2 parents 972c372 + 23cfb3d commit b40d831

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

realtime-time-date/index.html

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<!-- Required meta tags -->
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<!-- Bootstrap CSS -->
8+
<link
9+
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
10+
rel="stylesheet"
11+
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
12+
crossorigin="anonymous"
13+
/>
14+
<title>Realtime Date and Time</title>
15+
</head>
16+
17+
<body>
18+
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
19+
<div class="container-fluid">
20+
<a class="navbar-brand" href="#">Realtime Date and Time</a>
21+
</div>
22+
<div class="d-flex p-2" style="width: 350px;">
23+
<p class="fs-5 m-auto" style="color: lightgreen;">Created With &hearts; By Arpit</p>
24+
</div>
25+
</nav>
26+
<div class="container-fluid">
27+
<div class="p-3 mb-4 bg-light rounded-3">
28+
<div class="container-fluid">
29+
<h1 class="display-5 fw-bold py-3">
30+
Current Time : <span id="time" class="text-primary"></span>
31+
</h1>
32+
<p class="col-md-12 fs-4 my-4">
33+
"Lost time is never found again." –
34+
<small class="text-muted">Benjamin Franklin.</small>
35+
<br />
36+
"Time is the most valuable thing a man can spend." –
37+
<small class="text-muted">Theophrastus.</small>
38+
<br />
39+
"Time is free, but it’s priceless. You can’t own it, but you can use
40+
it. You can’t keep it, but you can spend it. Once you’ve lost it you
41+
can never get it back." –
42+
<small class="text-muted">Harvey Mackay</small>
43+
</p>
44+
</div>
45+
</div>
46+
</div>
47+
<script src="main.js"></script>
48+
</body>
49+
</html>

realtime-time-date/main.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let a, date, day, times;
2+
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
3+
setInterval(() => {
4+
a = new Date();
5+
date = a.toLocaleDateString(undefined,options);
6+
times = a.toLocaleTimeString();
7+
//day =a.toLocaleString();
8+
document.getElementById("time").innerHTML = times + " on " + date;
9+
}, 1000);

0 commit comments

Comments
 (0)