1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
+ < link rel ="stylesheet " href ="style.css ">
7
+ <!-- Latest compiled and minified CSS -->
8
+ < link rel ="stylesheet " href ="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css " integrity ="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u " crossorigin ="anonymous ">
9
+ < title > Counting Days</ title >
10
+ </ head >
11
+ < body >
12
+ < h1 class ="heading "> Counting Days</ h1 >
13
+ <!-- Material form login -->
14
+ < form >
15
+ < div class ="form-group ">
16
+ < label for ="exampleInputEmail1 "> Year</ label >
17
+ < input type ="text " class ="form-control " id ="Year " placeholder ="Enter Year ">
18
+ </ div >
19
+ < div class ="form-group ">
20
+ < label for ="exampleInputPassword1 "> Month</ label >
21
+ < input type ="text " class ="form-control " id ="month " placeholder ="Enter month ">
22
+ </ div >
23
+ < div class ="form-check ">
24
+ < label for ="exampleInputPassword1 "> Day</ label >
25
+ < input type ="text " class ="form-control " id ="day " placeholder ="Enter Day ">
26
+ </ div >
27
+ </ form >
28
+ < button class ="btn btn-primary " onclick ="display() "> Submit</ button >
29
+
30
+ < h1 id ="finalAns "> </ h1 >
31
+
32
+ < script >
33
+ function display ( ) {
34
+ const Year = document . getElementById ( "Year" ) . value ;
35
+ const month = document . getElementById ( "month" ) . value ;
36
+ const day = document . getElementById ( "day" ) . value ;
37
+ const finalAns = document . getElementById ( "finalAns" ) ;
38
+ today = new Date ( ) ;
39
+ var newdate = new Date ( Year , month , day ) ;
40
+ var one_day = 1000 * 60 * 60 * 24 ;
41
+ finalAns . innerHTML = ( Math . ceil ( ( newdate . getTime ( ) - today . getTime ( ) ) / ( one_day ) ) +
42
+ " days left until required date" ) ;
43
+ }
44
+ </ script >
45
+
46
+
47
+ </ body >
48
+ </ html >
0 commit comments