Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

360/30 Accrual days

Status
Not open for further replies.

IanWaterman

Programmer
Jun 26, 2002
3,511
GB
This is not strictly a crystal problem, I just hope someone has had to create this formula before.

I am building a financial report which needs to calculate the accrual days of an investment. In some cases I must use what is known as the 360/30 method.

Eg 8/3/06 to 8/4/06 would normally be 32 days (system assumes investment from opening 8/3 to close 8/4), however, under 360/30 it would be 31 days. As it assumes all months are 30 days.

However, I am not totally clear on what happens happens when the start or end date is 31st.

Thanks in advance for any help.

Ian
 
Found answer form another source, so here its is just incase someone else needs to do this.

//To find the size of an interest period, use this formula:
//
//360(Y2-Y1)+30(M2-M1)+(D2-D1)
//where Yn is the year, Mn is the month, and Dn is the number of days.
//However,if D1=31, set D1=30. If D2 is 31 and D1 is 30 or 31, change D2 to 30;
//otherwise,leave at 31.

local numbervar D1:= day({PeriodStart});
local numbervar D2:= day({PeriodEnd});
local numbervar M1:= month({PeriodStart});
local numbervar M2:= month({PeriodEnd});
local numbervar Y1:= year({PeriodStart});
local numbervar Y2:= year({PeriodEnd});

If D1 = 31 then D1:=30;
If D2 = 31 and D1 = 30 then D2:=30;

(360*(Y2-Y1))+(30*(M2-M1))+(D2-D1)+1;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top