1const myDate = "2012-10-16T11:00:28.556094Z";
2const time = new Date(myDate).toLocaleTimeString('en',
3 { timeStyle: 'short', hour12: false, timeZone: 'UTC' });
4
5// Output: "11:00"
6
1date = new Date('2013-03-10T02:00:00Z');
2date.getFullYear()+'-' + (date.getMonth()+1) + '-'+date.getDate();//prints expected format.
1 function parseDate(input) {
2 return new Date(input); // Note: months are 0-based
3 }
4parseDate("2021-02-26T11:30:00.000Z")
1date = new Date('2013-08-03T02:00:00Z');
2year = date.getFullYear();
3month = date.getMonth()+1;
4dt = date.getDate();
5
6if (dt < 10) {
7 dt = '0' + dt;
8}
9if (month < 10) {
10 month = '0' + month;
11}
12
13console.log(year+'-' + month + '-'+dt);