Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
What Is poi-5.2.3.jar?
What Is poi-5.2.3.jar?
✍: FYIcenter.com
poi-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which
provides an API for Microsoft document files of Word, Excel, PowerPoint, and Visio.
poi-5.2.3.jar supports Apache POI components that read and write Microsoft's OLE 2 Compound document format, which is used in early versions of Microsoft Office tools like Word 97, Excel 97, PowerPoint 97, etc.
poi-5.2.3.jar is distributed as part of the poi-bin-5.2.3-20220909.zip download file.
JAR File Size and Download Location:
JAR name: poi-5.2.3.jar Target JDK version: 9 File name: poi.jar, poi-5.2.3.jar File size: 2964641 bytes Release date: 09-09-2022 Download: Apache POI Website
Here are Java Source Code files for poi-5.2.3.jar:
⏎ org/apache/poi/ss/formula/functions/Days360.java
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.formula.functions;
import java.time.LocalDate;
import java.util.Calendar;
import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.util.LocaleUtil;
/**
* <p>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.<p>
*
* {@code DAYS360(start_date,end_date,[method])}
*
* <ul>
* <li>Start_date, end_date (required):<br>
* The two dates between which you want to know the number of days.<br>
* If start_date occurs after end_date, the DAYS360 function returns a negative number.</li>
*
* <li>Method (optional):<br>
* A logical value that specifies whether to use the U.S. or European method in the calculation</li>
*
* <li>Method set to false or omitted:<br>
* 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:<br>
* On a non-leap year the function {@code =DAYS360("2/28/93", "3/1/93", FALSE)} returns 1 day
* because the DAYS360 function ignores the extra days added to February.<br>
* On a leap year the function {@code =DAYS360("2/29/96","3/1/96", FALSE)} returns 1 day for
* the same reason.</li>
*
* <li>Method Set to true:<br>
* 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:<br>
* On a non-leap year the function {@code =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.<br>
* On a leap year the function {@code =DAYS360("2/29/96", "3/1/96", TRUE)} returns
* 2 days for the same reason.</li>
* </ul>
*
* @see <a href="https://support.microsoft.com/en-us/kb/235575">DAYS360 Function Produces Different Values Depending on the Version of Excel</a>
*/
public class Days360 extends Var2or3ArgFunction {
@Override
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) {
try {
LocalDate d0 = Days.getDate(arg0, srcRowIndex, srcColumnIndex);
LocalDate d1 = Days.getDate(arg1, srcRowIndex, srcColumnIndex);
return new NumberEval(evaluate(DateUtil.getExcelDate(d0), DateUtil.getExcelDate(d1), false));
} catch (EvaluationException e) {
return e.getErrorEval();
}
}
@Override
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2) {
try {
LocalDate d0 = Days.getDate(arg0, srcRowIndex, srcColumnIndex);
LocalDate d1 = Days.getDate(arg1, srcRowIndex, srcColumnIndex);
ValueEval ve = OperandResolver.getSingleValue(arg2, srcRowIndex, srcColumnIndex);
Boolean method = OperandResolver.coerceValueToBoolean(ve, false);
return new NumberEval(evaluate(DateUtil.getExcelDate(d0), DateUtil.getExcelDate(d1),
method != null && method.booleanValue()));
} catch (EvaluationException e) {
return e.getErrorEval();
}
}
private static double evaluate(double d0, double d1, boolean method) {
Calendar realStart = getDate(d0);
Calendar realEnd = getDate(d1);
int[] startingDate = getStartingDate(realStart, method);
int[] endingDate = getEndingDate(realEnd, startingDate, method);
return
(endingDate[0]*360.0+endingDate[1]*30.0+endingDate[2])-
(startingDate[0]*360.0+startingDate[1]*30.0+startingDate[2]);
}
private static Calendar getDate(double date) {
Calendar processedDate = LocaleUtil.getLocaleCalendar();
processedDate.setTime(DateUtil.getJavaDate(date, false));
return processedDate;
}
private static int[] getStartingDate(Calendar realStart, boolean method) {
int yyyy = realStart.get(Calendar.YEAR);
int mm = realStart.get(Calendar.MONTH);
int dd = Math.min(30, realStart.get(Calendar.DAY_OF_MONTH));
if (!method && isLastDayOfMonth(realStart)) {
dd = 30;
}
return new int[]{yyyy,mm,dd};
}
private static int[] getEndingDate(Calendar realEnd, int[] startingDate, boolean method) {
int yyyy = realEnd.get(Calendar.YEAR);
int mm = realEnd.get(Calendar.MONTH);
int dd = Math.min(30, realEnd.get(Calendar.DAY_OF_MONTH));
if (!method && realEnd.get(Calendar.DAY_OF_MONTH) == 31) {
if (startingDate[2] < 30) {
realEnd.set(Calendar.DAY_OF_MONTH, 1);
realEnd.add(Calendar.MONTH, 1);
yyyy = realEnd.get(Calendar.YEAR);
mm = realEnd.get(Calendar.MONTH);
dd = 1;
} else {
dd = 30;
}
}
return new int[]{yyyy,mm,dd};
}
private static boolean isLastDayOfMonth(Calendar date) {
int dayOfMonth = date.get(Calendar.DAY_OF_MONTH);
int lastDayOfMonth = date.getActualMaximum(Calendar.DAY_OF_MONTH);
return (dayOfMonth == lastDayOfMonth);
}
}
⏎ org/apache/poi/ss/formula/functions/Days360.java
Or download all of them as a single archive file:
File name: poi-5.2.3-src.zip File size: 2479830 bytes Release date: 2022-09-09 Download
⇒ What Is poi-ooxml-5.2.3.jar?
⇐ What Is poi-bin-5.2.3-20220909.zip?
2017-04-04, ≈357🔥, 0💬
Popular Posts:
What is the jaxp\TypeInfoWriter.java provided in the Apache Xerces package? I have Apache Xerces 2.1...
layout.jar is a component in iText Java library to provide layout functionalities. iText Java librar...
If you are a Java developer, it is very often that you need to use some 3rd party libraries to perfo...
JRE 8 deploy.jar is the JAR file for JRE 8 Java Control Panel and other deploy tools. JRE (Java Runt...
maven-embedder-3.8.6.jar is the JAR file for Apache Maven 3.8.6 Embedder module. Apache Maven is a s...