About this question
I am getting this time from api response I need to display it in lightning:formatteddatetime, Sort those records based on date time so am doing this conversion in controller side
code:
string s = string.valueof(a2.get('server_modified'));
DateTime LDate = null;
if(s != null && s != ''){
s = s.replace('T', ' ');
s = s.replace('Z', '');
LDate = DateTime.valueof(s);
}