You need to sign in to do that
Don't have an account?

how to calculate number of holidays between two Dates
Hi all ,
I had a requirement to calcualte number of holidays betwwn two days using Business hours Holidays.
Any one can provide the code for it.
Thanks in advance.
I had a requirement to calcualte number of holidays betwwn two days using Business hours Holidays.
Any one can provide the code for it.
Thanks in advance.
Please try below soql which will return no of holidays that are saved in your company profile.
Holidays is a standard object available in salesforce from which u can get no of holidays.
Date s = date.newInstance(2014,04,01); //Get your start and end dates however you want
Date e = date.newInstance(2014,12,31);
Holiday[] h = [Select ID From Holiday Where ActivityDate >= :s AND ActivityDate <= :e];
Integer numOfHolidays = h.size();
Please let us know if this helps you.
Thanks and Regards
sandhya reddy
i have 5 different Business hours. so ineed to pic perticular business hours.
in businesses hours i have the following
1) Default
2) US hours
3) INDIA hours
4) USI Hours
5) TRT hours
out of these i need to pic only "US hours" related holidays. and its count.
The code you are ging is working but its picking from all the business hours.
use this code
sandhya
Its give me error's.