You need to sign in to do that
Don't have an account?
B2A
Formula field to calculate amount of days in the next month
I'm not even sure if apex trigger is required for this, since formula fields could possibly do this. Just wondering whether someone has done this or not.
The calculation/value currently should equal "31" since next month has that many days (August).
Any help would be great.
Thanks.
Hi B2A,
To calculate the number of days in current month, use this following formula
DAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1)-1)
For next month :
DAY(DATE(YEAR(TODAY()),MONTH(TODAY())+2,1)-1)
let me know if you have any issues.
All Answers
Hi,
May be this will solve your issue. Use following formula in your object with number type formula field.
CASE(MONTH(TODAY()),
1, IF(MOD(YEAR(TODAY()),100)==0 && MOD(YEAR(TODAY()),400)==0, 29, if(MOD(YEAR(TODAY()),4)==0,29,28)), 2, 31,
3, 30,
4, 31,
5, 30,
6, 31,
7, 31,
8, 30,
9, 31,
10, 30,
11, 31,
12, 31,
0)
Hi B2A,
To calculate the number of days in current month, use this following formula
DAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,1)-1)
For next month :
DAY(DATE(YEAR(TODAY()),MONTH(TODAY())+2,1)-1)
let me know if you have any issues.