function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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.

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