Class Days360
- java.lang.Object
-
- org.apache.poi.ss.formula.functions.Days360
-
- All Implemented Interfaces:
Function
,Function2Arg
,Function3Arg
public class Days360 extends Object
Calculates the number of days between two dates based on a 360-day year (twelve 30-day months), which is used in some accounting calculations. Use this function to help compute payments if your accounting system is based on twelve 30-day months.
DAYS360(start_date,end_date,[method])
- Start_date, end_date (required):
The two dates between which you want to know the number of days.
If start_date occurs after end_date, the DAYS360 function returns a negative number. - Method (optional):
A logical value that specifies whether to use the U.S. or European method in the calculation - Method set to false or omitted:
the DAYS360 function uses the U.S. (NASD) method. If the starting date is the 31st of a month, it becomes equal to the 30th of the same month. If the ending date is the 31st of a month and the starting date is earlier than the 30th of a month, the ending date becomes equal to the 1st of the next month, otherwise the ending date becomes equal to the 30th of the same month. The month February and leap years are handled in the following way:
On a non-leap year the function=DAYS360("2/28/93", "3/1/93", FALSE)
returns 1 day because the DAYS360 function ignores the extra days added to February.
On a leap year the function=DAYS360("2/29/96","3/1/96", FALSE)
returns 1 day for the same reason. - Method Set to true:
When you set the method parameter to TRUE, the DAYS360 function uses the European method. Starting dates or ending dates that occur on the 31st of a month become equal to the 30th of the same month. The month February and leap years are handled in the following way:
On a non-leap year the function=DAYS360("2/28/93", "3/1/93", TRUE)
returns 3 days because the DAYS360 function is counting the extra days added to February to give February 30 days.
On a leap year the function=DAYS360("2/29/96", "3/1/96", TRUE)
returns 2 days for the same reason.
-
-
Constructor Summary
Constructors Constructor Description Days360()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValueEval
evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1)
ValueEval
evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2)
ValueEval
evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex)
-
-
-
Method Detail
-
evaluate
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1)
Description copied from interface:Function2Arg
-
evaluate
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2)
Description copied from interface:Function3Arg
-
evaluate
public final ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex)
- Specified by:
evaluate
in interfaceFunction
- Parameters:
args
- the evaluated function arguments. Empty values are represented withBlankEval
orMissingArgEval
, nevernull
.srcRowIndex
- row index of the cell containing the formula under evaluationsrcColumnIndex
- column index of the cell containing the formula under evaluation- Returns:
- The evaluated result, possibly an
ErrorEval
, nevernull
. Note - Excel uses the error code #NUM! instead of IEEE NaN, so when numeric functions evaluate toDouble.NaN
be sure to translate the result toErrorEval.NUM_ERROR
.
-
-