You need to sign in to do that
Don't have an account?
hy.lim1.3897974166558203E12
date time (System.now()) value minus numeric field doesnt work
i have a trigger that will update a custom date/time field in my case but it seems like not working
This is my trigger:
c.SLA_Cont_Time__c = System.now() - c.SLA_Days_mins__c;
c.SLA_Cont_Time__c is my custom date/time field and c.SLA_Days_mins__c is a numeric field that i need to minus it to get latest value. but my c.SLA_Cont_Time__c keep getting the System.now() value instead. why it will not take the after subtraction value?
anything wrong?
This is my trigger:
c.SLA_Cont_Time__c = System.now() - c.SLA_Days_mins__c;
c.SLA_Cont_Time__c is my custom date/time field and c.SLA_Days_mins__c is a numeric field that i need to minus it to get latest value. but my c.SLA_Cont_Time__c keep getting the System.now() value instead. why it will not take the after subtraction value?
anything wrong?
Hi,
for minus the no of days use adddays() method.
try the below code snippet as reference :
datetime d1=system.now().adddays(-4);
system.debug('aa'+d1);
Thanks
Ankit Gupta
All Answers
Hi,
for minus the no of days use adddays() method.
try the below code snippet as reference :
datetime d1=system.now().adddays(-4);
system.debug('aa'+d1);
Thanks
Ankit Gupta