Tool
JavaScript Unix Timestamp Snippets
JavaScript examples for getting the current timestamp, converting Unix seconds or milliseconds to Date objects, and formatting output with built-in browser APIs.
JavaScript timestamp basics
JavaScript Date stores time as milliseconds since the Unix epoch. Use Date.now() when you need milliseconds and Math.floor(Date.now() / 1000) when an API expects Unix seconds.
Common JavaScript conversions
When converting a Unix timestamp in seconds to a Date, multiply by 1000 before calling new Date(). Use toISOString() for UTC output, toUTCString() for HTTP-style output, and Intl.DateTimeFormat when you need a specific timezone.