I wanna convert String date and time to Apex date and time.
2016-12-23T07:26:33+0000 => DateTime Of apex.
How to convert ?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
I think de-serializing it to a DateTime class should work fine.
Just make sure that the date is enclosed in double quotes i.e
Try this one
String dateTimeInString = '2016-12-23T07:26:33+0000'; DateTime acceptableDateTime = DateTime.Valueof(dateTimeInString.replace('T', ' '));