File tree Expand file tree Collapse file tree 2 files changed +216
-193
lines changed
Expand file tree Collapse file tree 2 files changed +216
-193
lines changed Original file line number Diff line number Diff line change @@ -7,12 +7,12 @@ var second = document.querySelector("#second");
77function setCurrentDate ( ) {
88 var currentDate = new Date ( ) ;
99 var currentYear = currentDate . getFullYear ( ) ;
10- var currentMonth = currentDate . getMonth ( ) + 1 ;
10+ var currentMonth = currentDate . getMonth ( ) + 1 ; //Add 1 to month because 0 is January in JavaScript and 1 in Java
1111 var currentDay = currentDate . getDate ( ) ;
1212 var currentHour = currentDate . getHours ( ) ;
1313 var currentMinute = currentDate . getMinutes ( ) ;
1414 var currentSecond = currentDate . getSeconds ( ) ;
15- year . value = currentYear ;
15+ year . value = currentYear ; //set the input values to current local date and time
1616 month . value = currentMonth ;
1717 day . value = currentDay ;
1818 hour . value = currentHour ;
@@ -27,7 +27,7 @@ function setCurrentUtcDate() {
2727 var currentUtcHour = currentDate . getUTCHours ( ) ;
2828 var currentUtcMinute = currentDate . getUTCMinutes ( ) ;
2929 var currentUtcSecond = currentDate . getUTCSeconds ( ) ;
30- year . value = currentUtcYear ;
30+ year . value = currentUtcYear ; //set the input values to current UTC date and time
3131 month . value = currentUtcMonth ;
3232 day . value = currentUtcDay ;
3333 hour . value = currentUtcHour ;
You can’t perform that action at this time.
0 commit comments