I am having an requirement. I am having Number field (NumberField_c) in a custom Setting (MyCSObj_c).
So I have to retrieve NumberField__c value from custom seting and need to check whether that number has any fractional part or not.
If that number doesn't has any fractional part then subtract that number of months from the end date and use that value for start date.
public with sharing class MyClassController {
public DummySObject__c dummyObj{get; set;}
public MyClassController(){
dummyObj = new DummySObject__c();
dummyObj.EndDateA__c = system.today();
MyCSObj__c appConstantSettings = MyCSObj__c.getInstance();
if(appConstantSettings != null
&& appConstantSettings .NumberField__c!= null){
Decimal interaction_Month = appConstantSettings.NumberField__c;
}
}
My questions are : 1) How to check the number is fractional or not 2) How to subtract any number from current date? (For example: Today's date : 2014-03-18 00:00:00; Number we get 1. So we have to reduce 1 month from current date.
Any help'd be appriciated.