epoch-to-human Convert Unix timestamp to human-readable date
Examples
Convert a Unix timestamp to a readable date
Usage
"1700000000" | epoch-to-human Decode a timestamp from a customer's error report
Usage
"1718467200" | epoch-to-human Convert epoch values from a database export to dates
Usage
"1609459200" | epoch-to-human View source
(input)=>{
const ts = parseInt(input.trim());
if (isNaN(ts)) return "Error: provide a numeric Unix timestamp";
const d = new Date(ts > 1e12 ? ts : ts * 1000);
return `ISO: ${d.toISOString()}\nUTC: ${d.toUTCString()}\nLocal: ${d.toLocaleString()}`;
}