I keep getting:
Invalid date/time: 2018-06-10T12:34:15.29
Received from endpoint as and is stored in endpointResponse:
2018-06-10T12:34:15.290000
I process by:
string lastDate0String = endpointResponse.client[0].lastUpdated;
string lastDate1String = endpointResponse.client[1].lastUpdated;
string lastDate0 = lastDate0String.left(22);
string lastDate1 = lastDate1String.left(22);
dateTime lastUpdated1 = Datetime.valueOf(lastDate0);
dateTime lastUpdated2 = Datetime.valueOf(lastDate1);
if (lastUpdated1 > lastUpdated2) {
//1 is newer than 2
}
else {
//2 is newer than 1
}
I get the error from:
dateTime lastUpdated1 = Datetime.valueOf(lastDate0);
I found the following article for Dataloader/API proper datetime formatting which I would think would be the same, but cannot find specific formatting examples for Apex. I'm obviously getting this wrong.