All Rounder Tools Blogger-Best blog for blogger: Unix Timestamp Converter Tool with colorful styling and all its features use any free library

Tuesday, November 5, 2024

Unix Timestamp Converter Tool with colorful styling and all its features use any free library

 

Unix Timestamp Converter

Unix Timestamp Converter

Converted Date and Time:

/* Global styles */ body { font-family: 'Arial', sans-serif; background-color: #f4f7fa; margin: 0; padding: 0; height: 100vh; } /* Container styles */ .container { max-width: 600px; padding-top: 30px; } /* Card styling */ .card { box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); border-radius: 10px; } .card-body { background: #ffffff; border-radius: 10px; } /* Button Styling */ button { font-size: 16px; padding: 10px; } button:hover { background-color: #007bff; } button i { margin-left: 8px; } /* Result display */ .result { background-color: #fff3cd; border: 1px solid #ffeeba; padding: 10px; border-radius: 5px; margin-top: 20px; } #convertedDate { font-size: 18px; color: #28a745; } document.getElementById('convertBtn').addEventListener('click', function() { const timestampInput = document.getElementById('timestampInput').value; const convertedDate = document.getElementById('convertedDate'); if (timestampInput === '') { convertedDate.innerHTML = 'Please enter a valid Unix timestamp.'; } else { const unixTimestamp = parseInt(timestampInput); if (isNaN(unixTimestamp)) { convertedDate.innerHTML = 'Please enter a valid number.'; } else { // Use moment.js to convert Unix timestamp const date = moment.unix(unixTimestamp).format('MMMM Do YYYY, h:mm:ss a'); convertedDate.innerHTML = date; } } });

No comments:

Post a Comment