I am receiving date from back end in 2017-03-02T08:12:22.997000+00:00
this format.
To display this date in specified format I am doing
new Date('2017-03-02T08:12:22.997000+00:00').toLocaleString()
that gives 3/2/2017, 1:42:22 PM
There's one functionality which is sorting this formatted output.
Agenda is to sort the output based on 'date' type. But since I am using toLocaleString()
method for formatting, sorting is done based on 'string' type.
Is there any solution where I can achieve 3/2/2017, 1:42:22 PM
format and type will be a Date object?
Or a date format where I can see date along with time excluding GMT part? (like toUTCString()
)
Or any method from moment will work?