You need to sign in to do that
Don't have an account?
Amit Goyal
Trigger Issue: DateTime_Field = Date_Value + Integer_Value; = Expected_Result - 1
I have found a issue or whatever which is not clear to me.
I have a trigger on Account on Before Insert and Before update events. and code is as follows.
DateTime_Field__c field is a DateTime field. My System date is 1/23/2015 2:24 PM.
trigger AccountAddressTrigger on Account (before insert, before update) {
for(Account acc: Trigger.New){
acc.DateTime_Field__c = System.today() + 7;
}
}
Issue:
When I am assigning System.Now() + 7, Its assigning the date 1/30/2015 4:00 PM
When I am assigning System.Today() + 7, Its assigning the date 1/29/2015 4:00 PM
I tried the same with my other laptop and other developer account, with System.Today() + 2, and System.Now() + 2
The DateTime_Field = System.Today() + Integer_Value; always assigning the date Expected - 1.
What could be the reason.
I have a trigger on Account on Before Insert and Before update events. and code is as follows.
DateTime_Field__c field is a DateTime field. My System date is 1/23/2015 2:24 PM.
trigger AccountAddressTrigger on Account (before insert, before update) {
for(Account acc: Trigger.New){
acc.DateTime_Field__c = System.today() + 7;
}
}
Issue:
When I am assigning System.Now() + 7, Its assigning the date 1/30/2015 4:00 PM
When I am assigning System.Today() + 7, Its assigning the date 1/29/2015 4:00 PM
I tried the same with my other laptop and other developer account, with System.Today() + 2, and System.Now() + 2
The DateTime_Field = System.Today() + Integer_Value; always assigning the date Expected - 1.
What could be the reason.
but my question is why the above scenario is working or if working giving the wrong result.