From df3e2aff5bd3540a426764a27607eb28112ee3fd Mon Sep 17 00:00:00 2001 From: Brenna Date: Fri, 19 May 2017 14:26:16 -0700 Subject: [PATCH 1/3] pseudocoded --- index.css | 2 +- index.html | 4 ++++ index.js | 14 +++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/index.css b/index.css index ec4a909..4a59ff4 100644 --- a/index.css +++ b/index.css @@ -1,5 +1,5 @@ body { - background-color: #80d4ea; + background-color: #74D9DE; } #clock { diff --git a/index.html b/index.html index 191d3cc..c5ea9c0 100644 --- a/index.html +++ b/index.html @@ -11,4 +11,8 @@ + diff --git a/index.js b/index.js index 877a3aa..f0de8f2 100644 --- a/index.js +++ b/index.js @@ -1 +1,13 @@ -// Your code here +$(document).ready(function() { + +// Use the Date Library in Javascript to retrieve the current date and time information. + var time = Date.now(); + +// Use the different methods that are provided to you for retrieving the individual hour, minute and second information. + +// Use the setInterval method to utilize the function you've created to update each second. + +// add this to +$('#div').append(); + +}); From 4cb2c23ffc2fa3bb76bfe4607b0cc694c04a880e Mon Sep 17 00:00:00 2001 From: Brenna Date: Fri, 19 May 2017 15:17:44 -0700 Subject: [PATCH 2/3] finished a clock :)) --- index.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index f0de8f2..58ab5cb 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,23 @@ $(document).ready(function() { -// Use the Date Library in Javascript to retrieve the current date and time information. - var time = Date.now(); +// Use the setInterval method to utilize the function you've created to update each second. + getTime(); -// Use the different methods that are provided to you for retrieving the individual hour, minute and second information. + var intervalSecond = window.setInterval(getTime, 1000); + + function getTime() { + // Use the Date Library in Javascript to retrieve the current date and time information. + var timeNow = new Date(); + + // Use the different methods that are provided to you for retrieving the individual hour, minute and second information. + var hours = ('0' + timeNow.getHours()).slice(-2); + var minutes = ('0' + timeNow.getMinutes()).slice(-2); + var seconds = ('0' + timeNow.getSeconds()).slice(-2); + var timeDisplay = $("

" + hours + " : " + minutes + " : " + seconds + "

"); + + $('div').html(timeDisplay); + } -// Use the setInterval method to utilize the function you've created to update each second. -// add this to -$('#div').append(); }); From eec2c9e65c5f0669aebaf746577643ac532b16e1 Mon Sep 17 00:00:00 2001 From: Brenna Date: Sun, 21 May 2017 20:45:01 -0700 Subject: [PATCH 3/3] couldn --- index.css | 2 +- index.html | 5 ++++- index.js | 20 +++++++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/index.css b/index.css index 4a59ff4..5f3204a 100644 --- a/index.css +++ b/index.css @@ -2,7 +2,7 @@ body { background-color: #74D9DE; } -#clock { +.clock { height: 100px; width: 800px; margin: auto; diff --git a/index.html b/index.html index c5ea9c0..311938e 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,10 @@ -
+
+ diff --git a/index.js b/index.js index 58ab5cb..538fdd8 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,26 @@ $(document).ready(function() { -// Use the setInterval method to utilize the function you've created to update each second. getTime(); + // getTime('#EST'); + // getTime('#CEST'); + // getTime('#JST'); - var intervalSecond = window.setInterval(getTime, 1000); + // Use the setInterval method to utilize the function you've created to update each second. + window.setInterval(getTime, 1000); function getTime() { // Use the Date Library in Javascript to retrieve the current date and time information. var timeNow = new Date(); + // I tried using arguments to get this to work but then the callback in the setInterval stopped working mysteriously :C + // if ( id == '#PST' ) { + // var timeNow = new Date(); + // } else if ( id == '#EST' ) { + // var timeNow = new Date() + 180; + // } else if ( id == '#CEST' ) { + // var timeNow = new Date() + 480; + // } else if ( id == '#PST' ) { + // var timeNow = new Date() + 960; + // } // Use the different methods that are provided to you for retrieving the individual hour, minute and second information. var hours = ('0' + timeNow.getHours()).slice(-2); @@ -17,7 +30,4 @@ $(document).ready(function() { $('div').html(timeDisplay); } - - - });