idk
This commit is contained in:
1 parent
6b6851b5cb
commit
62ddcfdb67
4 files changed
+102
No files matched your search
@@ -0,0 +1,28 @@
|
||||
/*font family from google fonts*/
|
||||
@import url("https://fonts.googleapis.com/css2?family=Oswald:wght@300;400&display=swap");
|
||||
|
||||
html {
|
||||
font-size: 62.5%; /*62.5% = 10px; to make it easier to calculate REM units.*/
|
||||
}
|
||||
body {
|
||||
text-align: center;
|
||||
font-family: "Oswald", sans-serif;
|
||||
font-weight: 300;
|
||||
font-size: 2.2rem;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: #faedcd;
|
||||
height: 100vh;
|
||||
}
|
||||
#clock {max-width: 600px;}
|
||||
|
||||
/* for smaller screens below 700px */
|
||||
@media only screen and (max-width: 700px) {
|
||||
body {font-size: 1.8rem;}
|
||||
}
|
||||
|
||||
/*for smaller screens below 300px*/
|
||||
@media only screen and (max-width: 300px) {
|
||||
body {font-size: 1.6rem;}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Document</title>
|
||||
<link rel="stylesheet" href="cloc.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="clock">
|
||||
<h1 id="date-time"></h1>
|
||||
</div>
|
||||
<script src="idk.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
window.addEventListener("load", () => {
|
||||
clock();
|
||||
function clock() {
|
||||
const today = new Date();
|
||||
|
||||
// get time components
|
||||
const hours = today.getHours();
|
||||
const minutes = today.getMinutes();
|
||||
const seconds = today.getSeconds();
|
||||
|
||||
//add '0' to hour, minute & second when they are less 10
|
||||
const hour = hours < 10 ? "0" + hours : hours;
|
||||
const minute = minutes < 10 ? "0" + minutes : minutes;
|
||||
const second = seconds < 10 ? "0" + seconds : seconds;
|
||||
|
||||
//make clock a 12-hour time clock
|
||||
const hourTime = hour > 12 ? hour - 12 : hour;
|
||||
|
||||
// if (hour === 0) {
|
||||
// hour = 12;
|
||||
// }
|
||||
//assigning 'am' or 'pm' to indicate time of the day
|
||||
const ampm = hour < 12 ? "AM" : "PM";
|
||||
|
||||
// get date components
|
||||
const month = today.getMonth();
|
||||
const year = today.getFullYear();
|
||||
const day = today.getDate();
|
||||
|
||||
//declaring a list of all months in a year
|
||||
const monthList = [
|
||||
"January",
|
||||
"February",
|
||||
"March",
|
||||
"April",
|
||||
"May",
|
||||
"June",
|
||||
"July",
|
||||
"August",
|
||||
"September",
|
||||
"October",
|
||||
"November",
|
||||
"December"
|
||||
];
|
||||
|
||||
//get current date and time
|
||||
const date = monthList[month] + " " + day + ", " + year;
|
||||
const time = hourTime + ":" + minute + ":" + second + ampm;
|
||||
|
||||
//combine current date and time
|
||||
const dateTime = date + " - " + time;
|
||||
|
||||
//print current date and time to the DOM
|
||||
document.getElementById("date-time").innerHTML = dateTime;
|
||||
setTimeout(clock, 1000);
|
||||
}
|
||||
});
|
||||
@@ -21,6 +21,7 @@
|
||||
<a href="https://disqus.com/profile/signup/">login sinup coments</a>
|
||||
<a href="popup.html">inportend</a>
|
||||
<a href="/snak.html">miless</a>
|
||||
<a href="/clok/clok.html">clock</a>
|
||||
|
||||
<p></p>
|
||||
|
||||
|
||||
Reference in new issue
Block a user