Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

MM/DD/YYYY format to new date javascript

const str = '22/04/2022';

const [day, month, year] = str.split('/');

console.log(day); //  22
console.log(month); //  04
console.log(year); //  2022

const date = new Date(+year, month - 1, +day);
console.log(date); //  Fri Apr 22 2022
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #format #date #javascript
ADD COMMENT
Topic
Name
7+1 =