Is there a way to change this date format:
Sun Jan 08 2012 00:00:00 GMT+0530 (Sri Lanka Standard Time)
to look like this:
2012-01-08
using JavaScript?
Thank you!
Edit:
I was working with ExtJS and discovered that there's an easier way to achieve this using its built-in functionality.
By making use of the following code snippet, I was able to transform the date successfully:
var date = new Date("Sun Jan 08 2012 00:00:00 GMT+0530 (Sri Lanka Standard Time)");
console.log(Ext.Date.format(date, 'Y-m-d'));
This resulted in 2012-01-08.