Convert Date String(yymmdd) To Date Object In Js
I have a date string in 'yymmdd' format i want to convert it into date object in JS the input string is '161208' I have tried code below var mydate = new Date(InputDate); but it s
Solution 1:
Check my answer. Basically you first need to give a proper format to your string. You can either do it manually or use moment.js.
stringFormat = moment(dateObject).format("YYYY-MM-DDTHH:mm:ss");date = new Date(stringFormat);
This is also really helpful to understand how the different string formats are compatible with different browsers.
Post a Comment for "Convert Date String(yymmdd) To Date Object In Js"