public class OpportunityStockAnswer {

    public static void SummaryStockAnswerUpdate(List<Opportunity> newList, Map<Id, Opportunity> newMap, List<Opportunity> oldList, Map<Id, Opportunity> oldMap){
    if (Trigger.isBefore && Trigger.isUpdate) {
       
                for (Opportunity newOpp : newList) {
                     Opportunity oldOpp = oldMap.get(newOpp.Id);
                     if (newOpp.Stock_Answer__c != oldOpp.Stock_Answer__c) {
                        Datetime dt = Datetime.now();
                        String temp = '';
                        temp += '******' + dt.format() + '******\n';
                        temp += newOpp.Stock_Answer__c;
                        if (oldOpp.StockAnswerSummary__c != null && oldOpp.StockAnswerSummary__c.trim().length() > 0) {
                        temp += '\n\n' + oldOpp.StockAnswerSummary__c;
                        }
                        newOpp.StockAnswerSummary__c = temp;
                        
            }
        } 
    
    }
    }
}