neeraj neeraj - 4 months ago 25
Javascript Question

Convert ISO Date to Date Format yyyy-mm-dd format in javascript

How can i get date having format yyyy-mm-dd from iso date?

My ISO Date is

2013-03-10T02:00:00Z


How can i get:

2013-03-10

Answer

Try this

date = new Date('2013-03-10T02:00:00Z');
date.getFullYear()+'-' + (date.getMonth()+1) + '-'+date.getDate();//prints expected format.