Trigger to update the Date field one day less than to next year

Sample Code:

trigger dateUpdate on Pincode__c (before insert, before update)
    for(Pincode__c p : trigger.New)
        p.X1st_Anniversary__c = p.Evaluation_Date__c.addDays(364);
        p.X6th_Anniversary__c = p.Evaluation_Date__c.addDays(2184);


1 comment:

  1. in this field
    suppose we have date as 2/09/2012
    so what is populated in X1st_Anniversary__c fields? is it


Sharing is Caring!!! Share this with your friends!!!

submit to reddit