You need to sign in to do that
Don't have an account?
Mildred Morales 19
360DAYS Method for calculations
Hi all!
I am trying to replicate the excel Days360 function which returns the number of days between 2 dates, based on a 360-day year (12 x 30 months).
Does anyone know how to accomplish this?
I am trying to replicate the excel Days360 function which returns the number of days between 2 dates, based on a 360-day year (12 x 30 months).
Does anyone know how to accomplish this?
A duration is calculated as an integral number of days between start date A and end date B. The difference in years, months and days are usually calculated separately:
Days360 (A,B) = ( YEAR(B) - YEAR(A) ) x 360+( MONTH (B) - MONTH(A) ) x 30 + ( DAY(B) - DAY(A) ) ; given that A <= B (approximation)
European and US method don't treat the last day of February in the same way.
European method:
- If either date A or B falls on the 31st of the month, that date will be changed to the 30th.
- Where date B falls on the last day of February, the actual date B will be used.
- All months are considered to last 30 days and hence a full year has 360 days.
US/NASD method: DAYS360 (Excel)Microsoft Excel and StarOffice/OpenOffice.org DAYS360 = NASD, but not SIA-compliant.
https://en.wikipedia.org/wiki/360-day_calendar
Last day of February is a problem of leap year: https://developer.salesforce.com/docs/atlas.en-us.usefulFormulaFields.meta/usefulFormulaFields/formula_examples_dates.htm
February 29 is a date that usually occurs every four years, and is called leap day. This day is added to the calendar in leap years.
February 28th is not always the last day of February and cannot be changed directly to the 30th without checking the leap year.
All Answers
A duration is calculated as an integral number of days between start date A and end date B. The difference in years, months and days are usually calculated separately:
Days360 (A,B) = ( YEAR(B) - YEAR(A) ) x 360+( MONTH (B) - MONTH(A) ) x 30 + ( DAY(B) - DAY(A) ) ; given that A <= B (approximation)
European and US method don't treat the last day of February in the same way.
European method:
- If either date A or B falls on the 31st of the month, that date will be changed to the 30th.
- Where date B falls on the last day of February, the actual date B will be used.
- All months are considered to last 30 days and hence a full year has 360 days.
US/NASD method: DAYS360 (Excel)Microsoft Excel and StarOffice/OpenOffice.org DAYS360 = NASD, but not SIA-compliant.
https://en.wikipedia.org/wiki/360-day_calendar
Last day of February is a problem of leap year: https://developer.salesforce.com/docs/atlas.en-us.usefulFormulaFields.meta/usefulFormulaFields/formula_examples_dates.htm
February 29 is a date that usually occurs every four years, and is called leap day. This day is added to the calendar in leap years.
February 28th is not always the last day of February and cannot be changed directly to the 30th without checking the leap year.
Finding an acceptable solution is often a real brainteaser with the formulas using dates. The final results are sometimes ridiculously complicated and not completely satisfactory but at least, we have tried.
Alain