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());
Related Posts:
- Add days to JavaScript Date
- Add days to JavaScript Date
- Getting current date and time in JavaScript
- How to format a JavaScript date
- How to format a JavaScript date
- How do I get the current date in JavaScript?
- Get String in YYYYMMDD format from JS date object?
- Compare two dates with JavaScript
- Compare dates with javascript
- Parsing a string to a date in JavaScript
- Current time formatting with Javascript
- Format JavaScript date as yyyy-mm-dd
- How to validate date with format “mm/dd/yyyy” in JavaScript?
- How to subtract date/time in JavaScript?
- Shortest way to print current year in a website
- Validate date in dd/mm/yyyy format using JQuery Validate
- Convert a Unix timestamp to time in JavaScript
- How to subtract days from a plain Date?
- How to add 30 minutes to a JavaScript Date object?
- How do you convert a JavaScript date to UTC?
- Convert UTC Epoch to local date
- Convert normal date to unix timestamp
- Check time difference in Javascript
- How to format a UTC date as a `YYYY-MM-DD hh:mm:ss` string using NodeJS?
- Moment Js UTC to Local Time
- What’s a Good Javascript Time Picker?
- Get hours difference between two dates in Moment Js
- Javascript: getFullyear() is not a function
- What is console.log?
- Can I use complex HTML with Twitter Bootstrap’s Tooltip?
- How do I redirect to another webpage?
- Invariant Violation: Objects are not valid as a React child
- How can I merge properties of two JavaScript objects dynamically?
- SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag
- Uncaught SyntaxError: Invalid or unexpected token
- JavaScript TypeError: Cannot read property ‘style’ of null
- Invalid shorthand property initializer
- nodejs – error self signed certificate in certificate chain
- How do I loop through or enumerate a JavaScript object?
- Getting Unexpected Token Export
- Uncaught TypeError: Cannot read property ‘props’ of null
- How to use iMonkey in an iOS app
- What’s the difference between “Array()” and “[]” while declaring a JavaScript array?
- Mouseover & Mouseout w/ Javascript
- Angular JS Uncaught Error: [$injector:modulerr]
- Nested objects in javascript, best practices
- Scroll Automatically to the Bottom of the Page
- How to change date format in JavaScript
- OnChange event handler for radio button (INPUT type=”radio”) doesn’t work as one value
- InvalidValueError: not an instance of HTMLInputElement
- How to clear react-native cache?
- Execute PHP function with onclick
- blocked a frame of origin “null” from accessing a cross-origin frame – chrome
- How can I resolve the error “URL scheme must be “http” or “https” for CORS request.” for this code [duplicate]
- Initializing an Array with a Single Value
- Is it possible to stop JavaScript execution?
- Remove commas from the string using JavaScript
- How can you remove all documents from a collection with Mongoose?
- React-Router : What is the purpose of IndexRoute?
- SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
- Add new attribute (element) to JSON object using JavaScript
- D3 Appending Text to a SVG Rectangle
- JavaScript button onclick not working
- What counts as CPU Intensive tasks (eg. sorting, searching etc?)
- HTML make text clickable without making it a hyperlink
- Uncaught ReferenceError: React is not defined
- How to get the browser viewport dimensions?
- Getting HTML form values
- Object doesn’t support property or method ‘addEventListener’
- How to fix javascript .toFixed is not a Function error
- jQuery checkbox checked state changed event
- Javascript, viewing [object HTMLInputElement]
- Why onbeforeunload event is not firing
- Any advantage of using wp_scripts and is_IE when enqueuing scripts
- TinyMCE in a div / textarea on frontend?
- Include Javascript as Plain (No file inclusion)
- Adding wp_ajax to a theme outside functions.php (on specific template page)
- Insert shortcode in post editor from javascript (Visual / HTML)
- Provide specific example for block variation
- Block editor: How to check if block editor has initialized and populated the data store?
- Contact Form 7 – Give each checkbox a class?
- How to add a custom.js file for a child-theme in a swift way?
- var is undefined in a Gutenberg block
- Custom wp.editor.initialize settings ignored
- Why my javascript code not working for the dashboard of wordpress admin?
- Detect When User Reads Full Article? [closed]
- Got a TypeError after update and need to adapt found solution
- How to add classes and events to image in javascript using Gutenberg?
- Adding Code into Theme Customizer Header
- Javascript in wordpress
- How to inherit custom javascript from parent to child pages?
- Gutenberg – useEffect manipulate DOM after block re-renders DOM
- how to add a custom javascript file to our theme
- Why does my array sort order changes when I pass it to JS using WP_REST_Response?
- WordPress Guternberg Content For React Native
- Custom block update rendering when reused
- contact form 7 javascript and wpcf7_before_send_mail action
- custom page url slug needs illegal ?id=1 for javascript
- Use one javascript variable into another javascript file
- Embed Kajabi into WP