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 › 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" }, ...
Discussions

javascript - How to convert date to timestamp? - Stack Overflow
3 Convert date time to integer timestamp in javascript More on stackoverflow.com
🌐 stackoverflow.com
How to REALLY get a UTC Date object

var date = new Date('2015-10-11T14:03:19.243Z'); var str = date.toISOString();

More on reddit.com
🌐 r/javascript
6
1
February 14, 2014
How to get timestamp from firestore in react-native
Use the toDate() method provided by firebase to convert firebase timestamps to JavaScript Date Objects More on reddit.com
🌐 r/reactnative
11
10
December 26, 2019
any way to include timestamps in logs?
Help > Options More on reddit.com
🌐 r/Bitburner
9
7
December 29, 2021
🌐
Codedamn
codedamn.com › news › javascript
How to convert timestamp to date in JavaScript?
November 3, 2022 - We will utilize the moment.unix() method to do this. It takes a timestamp as an argument and outputs a date object.
🌐
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
Therefore, to use a Unix timestamp, we must multiply it by 1000. ... const myUnixTimestamp = 1691622800; // start with a Unix timestamp const myDate = new Date(myUnixTimestamp * 1000); // convert timestamp to milliseconds and construct Date ...
🌐
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 ...
🌐
Stack Abuse
stackabuse.com › bytes › how-to-convert-a-date-to-timestamp-in-javascript
How to Convert a Date to Timestamp in JavaScript
October 4, 2023 - It'll be a similar process as before, but with the extra step of converting the string to a Date object and then the timestamp. Just make sure your date string is in a format that the Date constructor can understand. According to MDN: The JavaScript specification only specifies one format to be universally supported: the date time string format, a simplification of the ISO 8601 calendar date extended format.
🌐
W3Schools
w3schools.com › jsref › jsref_obj_date.asp
JavaScript Date Reference
altKey (Mouse) altKey (Key) animationName bubbles button buttons cancelable charCode clientX clientY code ctrlKey (Mouse) ctrlKey (Key) currentTarget data defaultPrevented deltaX deltaY deltaZ deltaMode detail elapsedTime elapsedTime eventPhase inputType isTrusted key keyCode location metaKey (Mouse) metaKey (Key) newURL oldURL offsetX offsetY pageX pageY persisted propertyName relatedTarget relatedTarget screenX screenY shiftKey (Mouse) shiftKey (Key) target targetTouches timeStamp touches type which (Mouse) which (Key) view HTML Event Methods
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-convert-a-date-string-to-timestamp-in-javascript
How to Convert a Date String to Timestamp in JavaScript ? - GeeksforGeeks
July 23, 2025 - In this article, we are going to learn about the conversion of Date strings to Timestamps by using JavaScript.
🌐
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.
🌐
Toptal
toptal.com › developers › software › definitive-guide-to-datetime-manipulation
How to get the Timestamp And Date in Javascript: JS DateTime | Toptal®
December 2, 2020 - This makes JavaScript date-from-timestamp and JavaScript timestamp-to-date conversion straightforward, provided the UTC time zone is used.
🌐
Plain English
plainenglish.io › home › blog › javascript › how to convert a date string to timestamp in javascript?
How to Convert a Date String to Timestamp in JavaScript?
April 19, 2022 - The unix() method returns the timestamp in seconds so we don't have to divide the returned result by 1000. We can use plain JavaScript or Moment.js to convert a date string into a UNIX timestamp.
🌐
Nesin
nesin.io › blog › javascript-date-to-unix-timestamp
How to convert Date to Unix Timestamp in Javascript
April 2, 2023 - In Javascript, Date object has getTime() method and it returns number of milliseconds since the Unix epoch which is January 1, 1970 00:00:00 UTC · And unix timestamp are mostly represented in seconds not milliseconds and so we'll be converting ...
🌐
W3Schools
w3schools.com › js › js_date_methods.asp
JavaScript Date Methods
The getDay() method returns the weekday of a date as a number (0-6). In JavaScript, the first day of the week (day 0) is Sunday. Some countries in the world consider the first day of the week to be Monday.
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › data types
Date and time
Create a Date object with the time equal to number of milliseconds (1/1000 of a second) passed after the Jan 1st of 1970 UTC+0. // 0 means 01.01.1970 UTC+0 let Jan01_1970 = new Date(0); alert( Jan01_1970 ); // now add 24 hours, get 02.01.1970 UTC+0 let Jan02_1970 = new Date(24 * 3600 * 1000); alert( Jan02_1970 ); An integer number representing the number of milliseconds that has passed since the beginning of 1970 is called a timestamp.
🌐
Timestamp Converter
timestamp.online
Timestamp Converter
Convert timestamp to date or date to timestamp easily. Learn how to convert timestamp to date in Python, PHP, JavaScript, Bash, ...
🌐
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.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getTime
Date.prototype.getTime() - JavaScript | MDN
July 10, 2025 - 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.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › UTC
Date.UTC() - JavaScript | MDN
Integer value representing the millisecond segment of a time. Defaults to 0. A number representing the timestamp of the given date.