jxl.write.biff
Class DateRecord

java.lang.Object
  |
  +--jxl.biff.RecordData
        |
        +--jxl.biff.WritableRecordData
              |
              +--jxl.write.biff.CellValue
                    |
                    +--jxl.write.biff.DateRecord
All Implemented Interfaces:
ByteData, Cell, WritableCell
Direct Known Subclasses:
DateTime

public class DateRecord
extends CellValue

A date stored in the database


Inner Class Summary
protected static class DateRecord.GMTDate
          Class definition for a dummy variable
 
Field Summary
private  java.util.Date date
          The java representation of the date
(package private) static WritableCellFormat defaultDateFormat
          This is package protected so that the worksheet might detect whether or not to override it with the column cell format
private static long msInADay
           
private static int nonLeapDay
           
private  boolean time
          Indicates whether this is a full date, or just a time only
private static int utcOffsetDays
           
private  double value
          The excel value of the date
 
Fields inherited from class jxl.write.biff.CellValue
column, format, formattingRecords, referenced, row, sheet
 
Fields inherited from class jxl.biff.WritableRecordData
maxRecordLength
 
Fields inherited from class jxl.biff.RecordData
code, record
 
Constructor Summary
protected DateRecord(DateCell dc)
          Constructor invoked when copying a readable spreadsheet
protected DateRecord(int c, int r, java.util.Date d)
          Constructor invoked by the user API
protected DateRecord(int c, int r, java.util.Date d, CellFormat st)
          Constructor invoked from the user API
protected DateRecord(int c, int r, java.util.Date d, CellFormat st, boolean tim)
          Constructor invoked from the API
protected DateRecord(int c, int r, java.util.Date d, CellFormat st, DateRecord.GMTDate a)
          Constructor invoked from the user API
protected DateRecord(int c, int r, java.util.Date d, DateRecord.GMTDate a)
          Constructor invoked by the user API
 
Method Summary
private  void calculateValue(boolean adjust)
          Calculates the 1900 based numerical value based upon the utc value held in the date object
 java.lang.String getContents()
          Quick and dirty function to return the contents of this cell as a string.
 byte[] getData()
          Gets the binary data for writing
 java.util.Date getDate()
          Gets the date contained in this cell
 java.text.DateFormat getDateFormat()
          Gets the DateFormat used to format the cell.
 CellType getType()
          Returns the content type of this cell
 boolean isTime()
          Indicates whether the date value contained in this cell refers to a date, or merely a time.
protected  void setDate(java.util.Date d)
          Sets the date in this cell
protected  void setDate(java.util.Date d, DateRecord.GMTDate a)
          Sets the date in this cell, taking the timezone into account
 
Methods inherited from class jxl.write.biff.CellValue
decrementColumn, decrementRow, getCellFormat, getColumn, getRow, getXFIndex, incrementColumn, incrementRow, isHidden, isReferenced, setCellDetails, setCellFormat
 
Methods inherited from class jxl.biff.WritableRecordData
getBytes, handleContinueRecords
 
Methods inherited from class jxl.biff.RecordData
getCode, getRecord
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

value

private double value
The excel value of the date

date

private java.util.Date date
The java representation of the date

time

private boolean time
Indicates whether this is a full date, or just a time only

utcOffsetDays

private static final int utcOffsetDays

msInADay

private static final long msInADay

defaultDateFormat

static final WritableCellFormat defaultDateFormat
This is package protected so that the worksheet might detect whether or not to override it with the column cell format

nonLeapDay

private static final int nonLeapDay
Constructor Detail

DateRecord

protected DateRecord(int c,
                     int r,
                     java.util.Date d)
Constructor invoked by the user API
Parameters:
c - the column
r - the row
d - the date

DateRecord

protected DateRecord(int c,
                     int r,
                     java.util.Date d,
                     DateRecord.GMTDate a)
Constructor invoked by the user API
Parameters:
c - the column
r - the row
d - the date
a - adjust timezone

DateRecord

protected DateRecord(int c,
                     int r,
                     java.util.Date d,
                     CellFormat st)
Constructor invoked from the user API
Parameters:
c - the column
r - the row
st - the format for the date
d - the date

DateRecord

protected DateRecord(int c,
                     int r,
                     java.util.Date d,
                     CellFormat st,
                     DateRecord.GMTDate a)
Constructor invoked from the user API
Parameters:
c - the column
r - the row
st - the format for the date
d - the date
a - adjust for the timezone

DateRecord

protected DateRecord(int c,
                     int r,
                     java.util.Date d,
                     CellFormat st,
                     boolean tim)
Constructor invoked from the API
Parameters:
c - the column
r - the row
st - the date format
tim - time indicator
d - the date

DateRecord

protected DateRecord(DateCell dc)
Constructor invoked when copying a readable spreadsheet
Parameters:
dc - the date to copy
Method Detail

calculateValue

private void calculateValue(boolean adjust)
Calculates the 1900 based numerical value based upon the utc value held in the date object
Parameters:
adjust - TRUE if we want to incorporate timezone information into the raw UTC date eg. when copying from a spreadsheet

getType

public CellType getType()
Returns the content type of this cell
Returns:
the content type for this cell

getData

public byte[] getData()
Gets the binary data for writing
Overrides:
getData in class CellValue
Returns:
the binary data

getContents

public java.lang.String getContents()
Quick and dirty function to return the contents of this cell as a string. For more complex manipulation of the contents, it is necessary to cast this interface to correct subinterface
Returns:
the contents of this cell as a string

setDate

protected void setDate(java.util.Date d)
Sets the date in this cell
Parameters:
d - the date

setDate

protected void setDate(java.util.Date d,
                       DateRecord.GMTDate a)
Sets the date in this cell, taking the timezone into account
Parameters:
d - the date
a - adjust for timezone

getDate

public java.util.Date getDate()
Gets the date contained in this cell
Returns:
the cell contents

isTime

public boolean isTime()
Indicates whether the date value contained in this cell refers to a date, or merely a time. When writing a cell, all dates are fully defined, even if they refer to a time
Returns:
FALSE if this is full date, TRUE if a time

getDateFormat

public java.text.DateFormat getDateFormat()
Gets the DateFormat used to format the cell. This will normally be the format specified in the excel spreadsheet, but in the event of any difficulty parsing this, it will revert to the default date/time format.
Returns:
the DateFormat object used to format the date in the original excel cell