File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ < title > Display Date and Time</ title >
7+ < style >
8+ body {
9+ font-family : 'Poppins' , sans-serif;
10+ text-align : center;
11+ background : linear-gradient (135deg , # 667eea, # 764ba2 );
12+ height : 100vh ;
13+ display : flex;
14+ flex-direction : column;
15+ align-items : center;
16+ justify-content : center;
17+ color : white;
18+ }
19+ h2 {
20+ font-size : 24px ;
21+ margin-bottom : 20px ;
22+ }
23+ .container {
24+ background : rgba (255 , 255 , 255 , 0.1 );
25+ padding : 30px ;
26+ border-radius : 15px ;
27+ box-shadow : 0 4px 10px rgba (0 , 0 , 0 , 0.2 );
28+ backdrop-filter : blur (10px );
29+ }
30+ button {
31+ padding : 14px 28px ;
32+ font-size : 18px ;
33+ font-weight : bold;
34+ cursor : pointer;
35+ border : none;
36+ background : # ff4081 ;
37+ color : white;
38+ border-radius : 30px ;
39+ transition : transform 0.2s , background 0.3s ;
40+ outline : none;
41+ }
42+ button : hover {
43+ background : # f50057 ;
44+ transform : scale (1.05 );
45+ }
46+ # datetime {
47+ margin-top : 20px ;
48+ font-size : 22px ;
49+ font-weight : bold;
50+ background : rgba (255 , 255 , 255 , 0.2 );
51+ padding : 15px ;
52+ border-radius : 10px ;
53+ display : inline-block;
54+ min-width : 250px ;
55+ }
56+ </ style >
57+ </ head >
58+ < body >
59+ < div class ="container ">
60+ < h2 > Click the button to display the current date and time</ h2 >
61+ < button onclick ="displayDateTime() "> Show Date & Time</ button >
62+ < p id ="datetime "> </ p >
63+ </ div >
64+
65+ < script >
66+ function displayDateTime ( ) {
67+ const now = new Date ( ) ;
68+ document . getElementById ( 'datetime' ) . innerText = now ;
69+ }
70+ </ script >
71+ </ body >
72+ </ html >
You can’t perform that action at this time.
0 commit comments