0

I wanna convert String date and time to Apex date and time.

2016-12-23T07:26:33+0000 => DateTime Of apex.

How to convert ?

1

I think de-serializing it to a DateTime class should work fine.

System.debug(JSON.deserialize('"2016-12-23T07:26:33+0000"', DateTime.class));

Just make sure that the date is enclosed in double quotes i.e "<DATE>"

1

Try this one

String dateTimeInString = '2016-12-23T07:26:33+0000';

DateTime acceptableDateTime = DateTime.Valueof(dateTimeInString.replace('T', ' ')); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.