Split the string into its parts and provide them directly to the Date constructor:
Update:
var myDate = "26-02-2012";
myDate = myDate.split("-");
var newDate = new Date( myDate[2], myDate[1] - 1, myDate[0]);
console.log(newDate.getTime());
More Related Contents:
- Date is in string format
- Convert a Unix timestamp to time in JavaScript
- What are valid Date Time Strings in JavaScript?
- How do you display JavaScript datetime in 12 hour AM/PM format?
- Convert seconds to HH-MM-SS with JavaScript?
- JavaScript seconds to time string with format hh:mm:ss
- Get the time difference between two datetimes
- Current time formatting with Javascript
- How to parse a time into a Date object from user input in JavaScript?
- Get first and last date of current month with JavaScript or jQuery [duplicate]
- Getting current date and time in JavaScript
- Get time of specific timezone [duplicate]
- How do I calculate how many seconds between two dates?
- Calculate Timezone offset only for one particular timezone
- Making a live clock in javascript
- Get week of year in JavaScript like in PHP
- Comparing date part only without comparing time in JavaScript
- Get String in YYYYMMDD format from JS date object?
- getMonth in javascript gives previous month
- Add A Year To Today’s Date
- Min/Max of dates in an array?
- How to get year/month/day from a date object?
- How to round time to the nearest quarter hour in JavaScript?
- how to determine if date is weekend in javascript [closed]
- How to split a string at the first `/` (slash) and surround part of it in a “?
- Javascript Invalid Date Error in Internet Explorer
- Getting the date of next Monday
- Generate random date between two dates and times in Javascript
- Convert iso timestamp to date format with Javascript?
- Difference between two dates in minute, hours javascript