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

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

Introduction

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

Prototype

public static void setCalendar(Calendar calendar, int wholeDays, int millisecondsInDay,
            boolean use1904windowing, boolean roundSeconds) 

Source Link

Usage

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 ava 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();
}