I was trying to convert string to Time datatype in apex, any one help on this would be great.
Salesforce recently come up with new datatypes
URL. I was using the Time datatype and am unable to convert string value to Time.
Illegal assignment from String to Time error
APS_Treatment__c treat = [SELECT Id, APS_Start_Date__c, APS_Time1__c, APS_Time_1__c FROM APS_Treatment__c WHERE Id = :TreatId]; DateTime appTime = treat.APS_Start_Date__c; appTime = appTime.addhours(treat.APS_Time_1__c.hour()); appTime = appTime.addminutes(treat.APS_Time_1__c.minute()); String sd = String.valueOf(appTime.format('hh:mm:ss\'z\'')); treat.APS_Time_1__c = sd; update treat;