net.objectlab.kit.datecalc.common
Class ExcelDateUtil

Package class diagram package ExcelDateUtil
java.lang.Object
  extended by net.objectlab.kit.datecalc.common.ExcelDateUtil

public final class ExcelDateUtil
extends Object

Convert Excel Date to Jdk Date or Calendar.

Version:
$Revision: 235 $ $Date: 2007-01-04 13:31:58 -0500 (Thu, 04 Jan 2007) $
Author:
Benoit Xhenseval, $LastChangedBy: benoitx $

Method Summary
static Calendar getJavaCalendar(double excelDate, boolean use1904windowing)
          Given an Excel date with either 1900 or 1904 date windowing, converts it to a java.util.Date.
static Date getJavaDate(double excelDate, boolean use1904windowing)
          Given an Excel date with either 1900 or 1904 date windowing, converts it to a java.util.Date.
static Date getJavaDateOnly(double excelDate, boolean use1904windowing)
          Given an Excel date with either 1900 or 1904 date windowing, converts it to a java.util.Date.
static boolean isValidExcelDate(double excelDate)
          Given a double, checks if it is a valid Excel date.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getJavaCalendar

public static Calendar getJavaCalendar(double excelDate,
                                       boolean use1904windowing)
Given an Excel date with either 1900 or 1904 date windowing, converts it to a java.util.Date.

Parameters:
excelDate - The Excel date.
use1904windowing - true if date uses 1904 windowing, or false if using 1900 date windowing.
Returns:
Java representation of the date without any time.
See Also:
TimeZone

getJavaDateOnly

public static Date getJavaDateOnly(double excelDate,
                                   boolean use1904windowing)
Given an Excel date with either 1900 or 1904 date windowing, converts it to a java.util.Date.

Parameters:
excelDate - The Excel date.
use1904windowing - true if date uses 1904 windowing, or false if using 1900 date windowing.
Returns:
Java representation of the date without any time.
See Also:
TimeZone

getJavaDate

public static Date getJavaDate(double excelDate,
                               boolean use1904windowing)
Given an Excel date with either 1900 or 1904 date windowing, converts it to a java.util.Date. NOTE: If the default TimeZone in Java uses Daylight Saving Time then the conversion back to an Excel date may not give the same value, that is the comparison excelDate == getExcelDate(getJavaDate(excelDate,false)) is not always true. For example if default timezone is Europe/Copenhagen, on 2004-03-28 the minute after 01:59 CET is 03:00 CEST, if the excel date represents a time between 02:00 and 03:00 then it is converted to past 03:00 summer time

Parameters:
excelDate - The Excel date.
use1904windowing - true if date uses 1904 windowing, or false if using 1900 date windowing.
Returns:
Java representation of the date, or null if date is not a valid Excel date
See Also:
TimeZone

isValidExcelDate

public static boolean isValidExcelDate(double excelDate)
Given a double, checks if it is a valid Excel date.

Parameters:
excelDate - the double value
Returns:
true if valid


Copyright © 2006-2010 Appendium - Portfolio Financing Platform. All Rights Reserved.