let unix_timestamp = 1549312452;

// Create a new JavaScript Date object based on the timestamp
// multiplied by 1000 so that the argument is in milliseconds, not seconds
var date = new Date(unix_timestamp * 1000);

// Hours part from the timestamp
var hours = date.getHours();

// Minutes part from the timestamp
var minutes = "0" + date.getMinutes();

// Seconds part from the timestamp
var seconds = "0" + date.getSeconds();

// Will display time in 10:30:23 format
var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);

console.log(formattedTime);

For more information regarding the Date object, please refer to MDN or the ECMAScript 5 specification.

Answer from Aron Rotteveel on Stack Overflow
🌐
Sentry
sentry.io › sentry answers › javascript › convert unix timestamp to date and time in javascript
Convert Unix timestamp to date and time in JavaScript | Sentry
To convert these into human-readable dates and times, we can use JavaScript’s Date object. This object’s constructor takes a value similar to a Unix timestamp, but in milliseconds rather than seconds.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN
A JavaScript date is fundamentally specified as the time in milliseconds that has elapsed since the epoch, which is defined as the midnight at the beginning of January 1, 1970, UTC (equivalent to the UNIX epoch). This timestamp is timezone-agnostic and uniquely defines an instant in history.
🌐
Zipy
zipy.ai › blog › convert-unix-timestamp-to-date-and-time-in-javascript
convert unix timestamp to date and time in javascript
April 12, 2024 - For more complex formatting needs or to handle multiple locales and time zones, you might consider using a library like moment.js or date-fns. These libraries offer extensive functionalities for date and time manipulation, including straightforward Unix timestamp conversions.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-convert-unix-timestamp-to-time-in-javascript
How to convert Unix timestamp to time in JavaScript ? - GeeksforGeeks
July 12, 2025 - Convert the UNIX timestamp to milliseconds. Create a Date object. Use Intl.DateTimeFormat to format the time in the desired locale and options.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › parse
Date.parse() - JavaScript | MDN
The Date.parse() static method parses a string representation of a date, and returns the date's timestamp. // Standard date-time string format const unixTimeZero = Date.parse("1970-01-01T00:00:00Z"); // Non-standard format resembling toUTCString() const javaScriptRelease = Date.parse("04 Dec 1995 00:12:00 GMT"); console.log(unixTimeZero); // Expected output: 0 console.log(javaScriptRelease); // Expected output: 818035920000
🌐
Toptal
toptal.com › software › definitive-guide-to-datetime-manipulation
How to get the Timestamp And Date in Javascript: JS DateTime | ...
December 2, 2020 - This makes JavaScript date-from-timestamp and JavaScript timestamp-to-date conversion straightforward, provided the UTC time zone is used.
Find elsewhere
🌐
Timestamp Converter
timestamp.online › article › how-to-convert-timestamp-to-datetime-in-javascript
How To Convert Timestamp To Date and Time in JavaScript - Code Example
They are: toDateString · Converts the date portion of a Date object into a readable string · toGMTString · Deprecated. Use the toUTCString() method instead · toISOString · Returns the date as a string, using the ISO standard · toJSON · Returns the date as a string, formatted as a JSON date ·
🌐
W3Resource
w3resource.com › javascript-exercises › javascript-date-exercise-17.php
JavaScript: Convert a Unix timestamp to time - w3resource
// Define a JavaScript function ... { // Create a new Date object representing the UNIX timestamp multiplied by 1000 (to convert seconds to milliseconds) and store it in the variable dt var dt = new Date(t*1000); // Extract ...
🌐
Squash
squash.io › how-to-convert-a-unix-timestamp-to-time-in-javascript
How to Convert a Unix Timestamp to Time in Javascript
If you have a Unix timestamp in milliseconds, divide it by 1000 to convert it to seconds before performing the conversion. 2. If you need to perform multiple conversions or formatting operations, consider creating a helper function to encapsulate the logic. This can improve code readability and reusability. 3. Be aware of the limitations of date and time formatting in different locales.
🌐
CoreUI
coreui.io › answers › how-to-convert-a-timestamp-to-a-date-in-javascript
How to convert a timestamp to a date in JavaScript · CoreUI
October 2, 2025 - Convert a timestamp to a date in JavaScript using new Date() constructor with timestamp parameter for accurate date object creation.
🌐
Codedamn
codedamn.com › news › javascript
How to convert timestamp to date in JavaScript?
November 3, 2022 - Convert a timestamp to a valid date object using moment.js.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › now
Date.now() - JavaScript | MDN
// This example takes 2 seconds to run const start = Date.now(); console.log("starting timer..."); // Expected output: "starting timer..." setTimeout(() => { const ms = Date.now() - start; console.log(`seconds elapsed = ${Math.floor(ms / 1000)}`); // Expected output: "seconds elapsed = 2" }, ...
🌐
Day.js
day.js.org › docs › en › parse › unix-timestamp
Unix Timestamp (seconds) · Day.js
Create a Day.js object from a Unix timestamp (10 digits, seconds since the Unix Epoch).
🌐
SheCodes
shecodes.io › athena › 1363-how-to-convert-a-timestamp-to-hours-in-javascript
[JavaScript] - How to Convert a Timestamp to Hours in | SheCodes
Learn how to convert a timestamp to hours in JavaScript using the getHours() method from the Date object. Quick and easy example included.
🌐
Delft Stack
delftstack.com › home › howto › javascript › javascript convert timestamp to date
How to Convert Unix Timestamp to Date in JavaScript | Delft Stack
February 12, 2024 - In this example, the timestamp variable holds a Unix timestamp (in milliseconds) that corresponds to December 4, 2020, 19:34:25.663 UTC. By creating a new Date object with this timestamp, we are effectively converting the timestamp value into a human-readable date and time representation.
🌐
Scaler
scaler.com › home › topics › convert timestamp to date in javascript
Convert Timestamp to Date in JavaScript - Scaler Topics
October 13, 2022 - However, JavaScript has multiple functions to present date and time in a way that humans can understand. By using the Date() object and its methods in JavaScript the UNIX timestamps can be converted to the required date and time formats.