Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 35 additions & 6 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,44 @@ body {
background-color: #80d4ea;
}

#clock {

#clockName {
height: 100px;
width: 900px;
/*margin: auto;*/
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
padding-top: 10px;
font-family: courier, monospace;
/*text-align: center;*/
color: purple;
font-size: 40px;
}


#day {
height: 100px;
width: 800px;
margin: auto;
width: 900px;
/*margin: auto;*/
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
padding-top: 70px;
font-family: courier, monospace;
text-align: center;
color: white;
font-size: 100px;
/*text-align: center;*/
color: blue;
font-size: 40px;
}

#clock {
height: 100px;
/*width: 900px;*/
width: 90%;
/*margin: auto;*/
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
padding-top: 130px;
font-family: courier, monospace;
/*text-align: center;*/
color: green;
font-size: 40px;
}
8 changes: 8 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
</head>

<body>
<div id='clockName'>ON THE CLOCK!</div>
<div id='day'></div>
<div id='tester'></div>
<div id='clock'></div>
</body>
</html>

<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>

<script src="index.js"></script>
27 changes: 26 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
// Your code here
$(document).ready(function() {

var timer = function() {
var today = new Date();
//new Date() gets the current date and time stored internally as the number of millisecons since midnight Jan 1, 1970
var today_array = today.toDateString().split(" ");

document.getElementById("day").innerHTML = 'DATE: ' + today_array[0] +', ' +today_array[1] +" "+ today_array[2] +', ' +today_array[3];

var hoursInMilliseconds = (60 * 60 * 1000);
var offsetEST = 3 * hoursInMilliseconds;
var offsetSwiss = 9 * hoursInMilliseconds;

var pacificST = today.toLocaleTimeString();
var easternST = new Date ((today.getTime() + offsetEST )).toLocaleTimeString();
var switzerland = new Date ((today.getTime() + offsetSwiss )).toLocaleTimeString();

document.getElementById("clock").innerHTML = 'TIME:'+ "<br />" + 'Ada HQ: ' + pacificST + "<br />" + 'Dad & Friends, aka EST: ' + easternST + "<br />" + 'Land of Clocks, aka Switzerland, : ' +switzerland;

// ALTERNATE WAY OF ASSIGNING NEW TEXT TO #clock
// $('#clock').text('TIME:\n ADA HQ: ' + today.toLocaleTimeString());
};

setInterval(timer, 1000);

});