screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.2/umd/react.development.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.2/umd/react-dom.development.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script> </head> <body> <div id="app"></div> <script type="text/babel"> function App() { // Get the current year const currentYear = new Date().getFullYear(); // Get the last two digits of the current year const lastTwoDigits = currentYear.toString().slice(-2) return ( <div className='container'> <h3>React Js Get Current Year Last Two Digit </h3> <p className='year'>Current Year: {currentYear}</p> <p className='digits'>Last Two Digits: {lastTwoDigits}</p> </div> ); } ReactDOM.render(<App />, document.getElementById("app")); </script> <style> .container { max-width: 500px; margin: 0 auto; padding: 20px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column; align-items: center; justify-content: center; } /* Style for the year paragraph */ .year { font-size: 24px; color: #333; margin-bottom: 10px; } /* Style for the digits paragraph */ .digits { font-size: 18px; color: #555; } </style> </body> </html>