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
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 object ...
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › data types
Date and time
The call to Date.parse(str) parses the string in the given format and returns the timestamp (number of milliseconds from 1 Jan 1970 UTC+0).
Discussions

date - Convert a Unix timestamp to time in JavaScript - Stack Overflow
I am storing time in a MySQL database ... sent to some JavaScript code. How would I get just the time out of it? For example, in HH/MM/SS format. ... Just multiply by 1000 since JS timestamps are in milliseconds and PHP delivers in seconds. ... Here is a very useful link with different date format: ... More on stackoverflow.com
🌐 stackoverflow.com
How to convert date to timestamp? - javascript
You'd usually want to either leave it as it is in milliseconds (by omitting the /1000) or get the value in seconds in the form of a whole number (by wrapping it in a Math.floor). 2023-09-30T20:21:23.1Z+00:00 ... Great answer. Note it creates a millisecond timestamp. For a timestamp with seconds accuracy you can Date... More on stackoverflow.com
🌐 stackoverflow.com
Any way to see the exact time a message was sent/received?

You can derive the exact timestamp from any message by using its ID.

You can get the ID of a message by enabling Developer Mode in User Settings > Advanced, then right clicking any message (or user, or channel) to copy the ID to your clipboard

I made a simple page that converts this snowflake ID into a timestamp: https://snowsta.mp

More on reddit.com
🌐 r/discordapp
7
7
August 13, 2015
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 8, 2014
🌐
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.
🌐
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
var ts = new Date(1768200518 * 1000); console.log(ts.toISOString()); # 26-01-12T07:48:38+01:00 ... You may be also interested in: How To Get Current Timestamp In Bash, How To Get Current Time In Python, How To Convert Timestamp To Date and Time in Python, How To Get Current Timestamp In Python, Countdown to interesting timestampts
🌐
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
🌐
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.
🌐
Epoch Converter
epochconverter.com
Epoch Converter - Unix Timestamp Converter
Please note: All tools on this page are based on the date & time settings of your computer and use JavaScript to convert times. Some browsers use the current DST (Daylight Saving Time) rules for all dates in history. JavaScript does not support leap seconds. ... Epoch converter Batch converter Time zone converter Timestamp list LDAP converter GPS time converter Julian Day converter Chrome/WebKit timestamp Unix hex timestamp Cocoa Core Data timestamp Mac HFS+ timestamp NTP timestamp FAT timestamp SAS timestamp Excel OADate timestamp Seconds/days since year 0 Bin/Oct/Hex converter Year 2038 problem Countdown in seconds Epoch clock
🌐
Toptal
toptal.com › software › definitive-guide-to-datetime-manipulation
How to get the Timestamp And Date in Javascript: JS DateTime | Toptal®
December 2, 2020 - In JavaScript, a time stamp is the number of milliseconds that have passed since January 1, 1970. This makes JavaScript date-from-timestamp and JavaScript timestamp-to-date conversion straightforward, provided the UTC time zone is used.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN - Mozilla
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.
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-convert-date-to-timestamp
Convert a Date or Date String to Timestamp in JavaScript | bobbyhadz
Here is an example that splits a string and passes the parameters to the Date() constructor to create a Date object. index.js · Copied!// 👇️ Formatted as MM/DD/YYYY const str = '04/16/2022'; const [month, day, year] = str.split('/'); const date = new Date(+year, month - 1, +day); console.log(date); // 👉️ Sat Apr 16 2022 // ✅ Get timestamp const timestamp = date.getTime(); console.log(timestamp); // 👉️ 1650056400000 ·
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › parse
Date.parse() - JavaScript | MDN - Mozilla
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 · js ·
🌐
UsefulAngle
usefulangle.com › post › 258 › javascript-timestamp-to-date-time
Convert Timestamp to Date & Time in Javascript - UsefulAngle
December 19, 2019 - // unix timestamp var ts = 1565605570; // convert unix timestamp to milliseconds var ts_ms = ts * 1000; // initialize new Date object var date_ob = new Date(ts_ms); // year as 4 digits (YYYY) var year = date_ob.getFullYear(); // month as 2 digits (MM) var month = ("0" + (date_ob.getMonth() + 1)).slice(-2); // date as 2 digits (DD) var date = ("0" + date_ob.getDate()).slice(-2); // hours as 2 digits (hh) var hours = ("0" + date_ob.getHours()).slice(-2); // minutes as 2 digits (mm) var minutes = ("0" + date_ob.getMinutes()).slice(-2); // seconds as 2 digits (ss) var seconds = ("0" + date_ob.getS
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › now
Date.now() - JavaScript - MDN - Mozilla
// 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); ... A number representing the timestamp, in milliseconds, of the current time.
🌐
Futurestud.io
futurestud.io › tutorials › how-to-convert-a-unix-timestamp-to-a-date-in-javascript-or-node-js
How to Convert a UNIX Timestamp to a Date in JavaScript or Node.js
June 30, 2022 - /** * Returns a date instance from the given `unixTimestamp`. * * @param {Number} unixTimestamp Number of seconds since Unix epoch * * @returns {Date} */ function toDate (unixTimestamp) { return new Date(unixTimestamp * 1000) } Enjoy working with UNIX times and JavaScript dates! Get your weekly push notification about new and trending Future Studio content and recent platform enhancements ... Marcus is a fullstack JS developer.
🌐
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 - Note: The getTime() method returns the timestamp in milliseconds. If you need the timestamp in seconds, you can divide the result by 1000. So what if we have a date in string format? 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.
🌐
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 approach, we are using Date.valueOf() to Converts date string to Unix timestamp by creating a Date object and using its .valueOf() method for numerical timestamp 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.