+ Start a Discussion
Ravi MaliRavi Mali 

How to convert UTC timezone in Apex.

Hi all,

I've UTC time zone in String type want to insert in SF but facing conversion issue. Can anyone help me out.

Ex. String utcTime='2018-05-03T16:52:23Z'

Want to convert this string into DateTime so i can insert into SF.

Boss CoffeeBoss Coffee
Try the following:
String utcTime = '2018-05-03T16:52:23Z';
DateTime dt = DateTime.valueOf(utcTime.replace('T',' '));