Parsing dates is a pain in JavaScript as there's no extensive native support. However you could do something like the following by relying on the Date(year, month, day [, hour, minute, second, millisecond]) constructor signature of the Date object.

var dateString = '17-09-2013 10:08',
    dateTimeParts = dateString.split(' '),
    timeParts = dateTimeParts[1].split(':'),
    dateParts = dateTimeParts[0].split('-'),
    date;

date = new Date(dateParts[2], parseInt(dateParts[1], 10) - 1, dateParts[0], timeParts[0], timeParts[1]);

console.log(date.getTime()); //1379426880000
console.log(date); //Tue Sep 17 2013 10:08:00 GMT-0400

You could also use a regular expression with capturing groups to parse the date string in one line.

var dateParts = '17-09-2013 10:08'.match(/(\d+)-(\d+)-(\d+) (\d+):(\d+)/);

console.log(dateParts); // ["17-09-2013 10:08", "17", "09", "2013", "10", "08"]
Answer from plalx on Stack Overflow
🌐
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 ...
🌐
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 - ... Example: In this example, we are using the above-explained method. ... In this approach, using new Date() creates a date object from a string, then .getTime() extracts the Unix timestamp (milliseconds since 1970).
🌐
W3Schools
w3schools.com › jsref › jsref_tostring_date.asp
JavaScript Date toString() Method
The toString() method is used by JavaScript when an object needs to be displayed as a text (like in HTML), or when an object needs to be used as a string.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN
There are many ways to format a date as a string. 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.
🌐
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 - Here are some common ways to format dates in JavaScript. The toLocaleDateString() method is a built-in method of the Date object that returns a string representation of the date in the user’s local time zone.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › toTimeString
Date.prototype.toTimeString() - JavaScript | MDN
const event = new Date("August 19, 1975 23:15:30"); console.log(event.toTimeString()); // Expected output: "23:15:30 GMT+0200 (CEST)" // Note: your timezone may vary ... A string representing the time portion of the given date (see description for the format).
🌐
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
Converts a Date object to a string, according to universal time · You can learn more about toDateString in documentation. var ts = new Date(1768200518000); console.log(ts.toDateString()); # Mon Jan 12 2026 · You can learn more about toISOString in documentation. var ts = new Date(1768200518 * 1000); console.log(ts.toISOString()); # 26-01-12T07:48:38+01:00 · var ts = new Date(1768200518000); JavaScript ·
Find elsewhere
🌐
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 - In programming, we often need to deal with dates and times, which can be represented in a few different ways, like an object (via Date), a string (i.e. "2023-10-04T00:00:00.000Z"), or a timestamp (i.e. 1696377600000). In this Byte, we'll explore how to convert a date or date string to a timestamp in JavaScript.
🌐
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 - To convert a Unix timestamp to a date and time, you can use the Date constructor, passing the timestamp multiplied by 1000 (to convert seconds to milliseconds, as JavaScript deals with time in milliseconds).
🌐
Sling Academy
slingacademy.com › article › javascript-convert-timestamp-to-date-time-and-vice-versa
JavaScript: Convert timestamp to date time and vice versa - Sling Academy
It is used to represent the date, time, and time zone of a particular moment of life. The main difference between Unix timestamp and date time is the way in which they are represented. Unix timestamp is represented as a · numeric value, whereas date time is represented as a ... // define a reusable function const timestampToDate = (timestamp) => { var date = new Date(timestamp * 1000); return date.toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric', }); }; // try it console.log(timestampToDate(1479693087)); console.log(timestampToDate(1450138800));
🌐
Scaler
scaler.com › home › topics › convert timestamp to date in javascript
Convert Timestamp to Date in JavaScript - Scaler Topics
October 13, 2022 - There are several functions to convert timestamps to date and time in a different format that humans can read, for eg: toJSON() - the date is returned as JSON data in string format .
🌐
GitHub
gist.github.com › Pustur › 9b867bb2934803b4ff2314c0d2e21c79
JavaScript – Convert a timestamp to a string "X days X hours X minutes X seconds X milliseconds". Useful to show elapsed time since [event]
JavaScript – Convert a timestamp to a string "X days X hours X minutes X seconds X milliseconds". Useful to show elapsed time since [event] - timestamp-to-string.js
🌐
W3Schools
w3schools.com › jsref › jsref_totimestring.asp
JavaScript Date toTimeString() Method
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
🌐
Codedamn
codedamn.com › news › javascript
How to convert timestamp to date in JavaScript?
November 3, 2022 - In JavaScript, we can use this library to convert and format the timestamp value into a valid date format. We will utilize the moment.unix() method to do this.
🌐
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 - To convert a Unix timestamp to a localized date and time format, you can use the Intl.DateTimeFormat object. This object takes the locale and options as parameters to generate a formatted date string.
🌐
Medium
medium.com › @python-javascript-php-html-css › how-to-get-timestamps-in-javascript-a-guide-d5c2343afa32
How to Get Timestamps in JavaScript: A Guide
September 25, 2024 - You can use the toISOString() method to convert a date object to a string in ISO 8601 format. ... Create a date object with new Date(‘YYYY-MM-DD’) and then use getTime() to get the timestamp.
🌐
Index.dev
index.dev › blog › convert-string-to-date-javascript
6 Easy Ways To Convert String to Date in JavaScript
This blog post outlines six straightforward methods for converting a string to a date in JavaScript. Every approach possesses distinct advantages and applications: Date Constructor: Efficient and direct for ISO format. Date.parse(): Suitable for timestamps including temporal data.