[Solved] Convert string to date format using javascript
A little workaround could be the following, but if you have to manipulate dates a lot, I strongly recommend you to use the Moment.js library: https://momentjs.com/ var strDate = “2016-11-20”; var utcDate = new Date(strDate).toUTCString(); var convertedDate= utcDate.substring(utcDate.lastIndexOf(“, “) + 1, utcDate.lastIndexOf(” 00:”)); console.log(convertedDate.trim().replace(/\s/g, ‘-‘)); Pay attention that the implementation of this method may change … Read more