Example usage for org.apache.poi.ss.usermodel DateUtil DAY_MILLISECONDS

List of usage examples for org.apache.poi.ss.usermodel DateUtil DAY_MILLISECONDS

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel DateUtil DAY_MILLISECONDS.

Prototype

long DAY_MILLISECONDS

To view the source code for org.apache.poi.ss.usermodel DateUtil DAY_MILLISECONDS.

Click Source Link

Usage

From source file:ec.util.spreadsheet.poi.DateUtil2.java

License:EUPL

/**
 * Same as {@link DateUtil#getJavaDate(double, boolean)} but with calendar
 * as first parameter to reduce memory usage.
 *
 * @param calendar/*from ww w. j  av a2  s.c om*/
 * @param date
 * @param use1904windowing
 * @return
 */
public static Date getJavaDate(Calendar calendar, double date, boolean use1904windowing) {
    int wholeDays = (int) Math.floor(date);
    int millisecondsInDay = (int) ((date - wholeDays) * DateUtil.DAY_MILLISECONDS + 0.5);
    DateUtil.setCalendar(calendar, wholeDays, millisecondsInDay, use1904windowing);
    return calendar.getTime();
}

From source file:ec.util.spreadsheet.poi.FastPoiValueFactory.java

License:EUPL

/**
 * Same as {@link DateUtil#getJavaDate(double, boolean)} but with calendar
 * as first parameter to reduce memory usage.
 *
 * @param calendar/*from  w w  w. j av  a 2  s  .c  o m*/
 * @param date
 * @param use1904windowing
 * @return
 */
private static Date getJavaDate(Calendar calendar, double date, boolean use1904windowing) {
    int wholeDays = (int) Math.floor(date);
    int millisecondsInDay = (int) ((date - wholeDays) * DateUtil.DAY_MILLISECONDS + 0.5);
    DateUtil.setCalendar(calendar, wholeDays, millisecondsInDay, use1904windowing, false);
    return calendar.getTime();
}