月間隔
- test__c s = [select Id,Date1__c,Date2__c from test__c where Id ='a020K00001qK4HPQA0'];
- Integer monthsBetween = s.Date1__c.monthsBetween(s.Date2__c);
-
- list<test__c> testList = new list<test__c>();
- for(Integer i = 0;monthsBetween>=i;i++){
- system.debug('========='+monthsBetween);
- }
日間隔
- test__c s = [select Id,Date1__c,Date2__c from test__c where Id ='a020K00001qK4HPQA0'];
- Integer daysBetween = s.Date1__c.daysBetween(s.Date2__c);
-
- list<test__c> testList = new list<test__c>();
- for(Integer i = 0;daysBetween>=i;i++){
- system.debug('========='+daysBetween);
- }