[Javascript] How can I create a date object from string?
I want to create a date object from a given string, How to do that in Javascript?
1 Answer
4 years ago by Jahaan
You can use new Date() which converts string to date. For examlpe, check the below code and result
let str = '2021/12/31';
let dateStr = new Date(str);
console.log(dateStr);
4 years ago by Meera