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
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN
In essence, the timezone offset is the offset from UTC time, at the time represented by the Date object and at the location of the host environment. There are two groups of Date methods: one group gets and sets various date components by interpreting the timestamp as a local time, while the other uses UTC.
Discussions

How to convert date to timestamp?
It should have been in this standard date format YYYY-MM-DD, to use below equation. You may have time along with example: 2020-04-24 16:51:56 or 2020-04-24T16:51:56+05:30. It will work fine but date format should like this YYYY-MM-DD only. var myDate = "2020-04-24"; var timestamp = +new Date(myDate) More on stackoverflow.com
🌐 stackoverflow.com
Converting unix timestamp to utc date
I am working on the backend server test and I have to convert unix timestamp to utc date can anybody help? More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
0
September 17, 2022
Date and time in JavaScript
There was a lot less cursing in that article than I expected. More on reddit.com
🌐 r/javascript
30
67
December 29, 2017
How can I save the values in the datepicker as the same with Firebase timestamp?
There is a from dateDate method on a Timestamp which will create a Timestamp from a javascript Date object. https://firebase.google.com/docs/reference/js/firebase.firestore.Timestamp#static-fromdate More on reddit.com
🌐 r/Firebase
2
4
February 5, 2021
🌐
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 › 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 ...
🌐
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" }, 2000); ...
🌐
Timestamp Converter
timestamp.online
Timestamp To Date Converter
Convert timestamp to date or date to timestamp easily. Learn how to convert timestamp to date in Python, PHP, JavaScript, Bash, ...
🌐
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.
Find elsewhere
🌐
W3Schools
w3schools.com › js › js_dates.asp
W3Schools.com
February 4, 2026 - JS Scope JS Code Blocks JS Hoisting JS Strict Mode JS Dates
🌐
date-fns
date-fns.org
date-fns - modern JavaScript date utility library
date-fns provides the most comprehensive yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js.
🌐
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.
🌐
InfluxData
influxdata.com › home › how to get, convert & format javascript date from timestamp | influxdata
How to Get, Convert & Format JavaScript Date From Timestamp | InfluxData
February 10, 2023 - Once installed, we can use its API to format dates in various ways. const moment = require('moment'); const timestamp = 1616608200000; // example timestamp const formattedDate = moment(timestamp).format('dddd, MMMM Do YYYY'); console.log(fo...
🌐
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
The Unix timestamp is an integer that represents times according to the number of seconds since midnight on the 1st of January, 1970. For example: 20 seconds and 13 minutes past 1 am on the 10th of August 2023 can be written as 1691622800.
🌐
Makitweb
makitweb.com › home › javascript › convert unix timestamp to date time with javascript
Convert Unix timestamp to Date time with JavaScript
December 4, 2022 - Set the formatted date time value ...'Jul','Aug','Sep','Oct','Nov','Dec']; // Convert timestamp to milliseconds var date = new Date(unixtimestamp*1000); // Year var year = date.getFullYear(); // Month var month = months_arr[dat...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › HTML › Reference › Elements › input › date
<input type="date"> - HTML | MDN
js · const dateControl = document.querySelector('input[type="date"]'); dateControl.value = "2017-06-01"; console.log(dateControl.value); // prints "2017-06-01" console.log(dateControl.valueAsNumber); // prints 1496275200000, a JavaScript timestamp (ms) This code finds the first <input> element whose type is date, and sets its value to 2017-06-01 (June 1st, 2017).
🌐
freeCodeCamp
forum.freecodecamp.org › t › converting-unix-timestamp-to-utc-date › 564600
Converting unix timestamp to utc date - The freeCodeCamp Forum
September 17, 2022 - I am working on the backend server test and I have to convert unix timestamp to utc date can anybody help?
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getTime
Date.prototype.getTime() - JavaScript | MDN
const moonLanding = new Date("July 20, 69 20:17:40 GMT+00:00"); // Milliseconds since Jan 1, 1970, 00:00:00.000 GMT console.log(moonLanding.getTime()); // Expected output: -14182940000 ... A number representing the timestamp, in milliseconds, of this date.
🌐
Coderszine
coderszine.com › convert-timestamp-to-date-using-javascript
Build Timestamp Converter to Date with JavaScript – Coderszine
Now in convert.js file, we will implement functionality to convert timestamp to date using MomentJS functions.
🌐
Toptal
toptal.com › developers › software › definitive-guide-to-datetime-manipulation
The Definitive Guide to DateTime Manipulation
December 2, 2020 - Discover efficient JS date manipulation, from handling timestamps to using DateTime, in this essential guide for developers.