I have a datetime field that is populated by the user in pst timezone.I want to convert this field to the local timezone of the lead owner.How can i achieve this?I have tried this so far i am getting Invalid time error what i am missing here.Any help would be appreciated?
User currentUser = [Select TimeZoneSidKey from User where id =: lead.ownerId and isActive=true limit 1];
DateTime startDate;
system.debug('currentUser.TimeZoneSidKey'+currentUser.TimeZoneSidKey);
if(currentUser.TimeZoneSidKey!='America/Los_Angeles') {
//TimeZone tz = TimeZone.getTimeZone(currentUser.TimeZoneSidKey);
string currentDate =ld.Activation_Reactivation_Date__c.format('MM/dd/yyyy HH:mm:ss', currentUser.TimeZoneSidKey);
startDate = Datetime.valueof(currentDate);
} else {
startDate =lead.Activation_Reactivation_Date__c;
}