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
Som_11Som_11 

While inserting the record datetime field value changing to different timezone and inserting but its not getting changed to inserted timezone

Hi All,
Using below method :
  public static datetime convertTimeZone(datetime dt, String timezone){
     String formatedDtTime = dt.format('yyyy-MM-dd HH:mm:ss', 
                         CDLLoanRequestUtil.TIME_ZONE_MAPPING.get(timezone));
     Datetime converteddt = Datetime.valueOf(formatedDtTime); 
     return converteddt;
                 
     } 

Datetime newdt = CDLLoanRequestUtil.convertTimeZone(callBackDtTime,'America/Los_Angeles');

Expected to enter with above datetime but after creating record it getting changed. And in debug its comming correct value. Can anyone help with this please.