jxl.write

Class DateTime

Implemented Interfaces:
jxl.biff.ByteData, Cell, DateCell, WritableCell

public class DateTime
extends jxl.write.biff.DateRecord
implements WritableCell, DateCell

A Date which may be created on the fly by a user application and added to a spreadsheet NOTE: By default, all dates will have local timezone information added to their UTC value. If this is not desired (eg. if the date entered represents an interval eg. 9.83s for the 100m world record, then use the overloaded constructor which indicate that the date passed in was created under the GMT timezone. It is important that when the date was created, an instruction like Calendar.setTimeZone(TimeZone.getTimeZone("GMT")) was made prior to that

Field Summary

static jxl.write.biff.DateRecord.GMTDate
GMT
Instance variable for dummy variable overload

Constructor Summary

DateTime(int c, int r, Date d)
Constructor
DateTime(int c, int r, Date d, CellFormat st)
Constructor which takes the format for this cell
DateTime(int c, int r, Date d, CellFormat st, boolean tim)
Constructor which takes the format for the cell and an indicator as to whether this cell is a full date time or purely just a time eg.
DateTime(int c, int r, Date d, CellFormat st, jxl.write.biff.DateRecord.GMTDate a)
Constructor, which adjusts the specified date to take timezone considerations into account
DateTime(int c, int r, Date d, jxl.write.biff.DateRecord.GMTDate a)
Constructor, which adjusts the specified date to take timezone considerations into account
DateTime(DateCell dc)
A constructor called by the worksheet when creating a writable version of a spreadsheet that has been read in

Method Summary

WritableCell
copyTo(int col, int row)
Implementation of the deep copy function
void
setDate(Date d)
Sets the date for this cell
void
setDate(Date d, jxl.write.biff.DateRecord.GMTDate a)
Sets the date for this cell, performing the necessary timezone adjustments

Methods inherited from class jxl.write.biff.DateRecord

getContents, getData, getDate, getDateFormat, getType, isTime

Methods inherited from class jxl.write.biff.CellValue

addCellFeatures, getCellFeatures, getCellFormat, getColumn, getData, getRow, getWritableCellFeatures, isHidden, removeCellFeatures, removeComment, removeDataValidation, setCellFeatures, setCellFormat

Methods inherited from class jxl.biff.WritableRecordData

getBytes

Field Details

GMT

public static final jxl.write.biff.DateRecord.GMTDate GMT
Instance variable for dummy variable overload

Constructor Details

DateTime

public DateTime(int c,
                int r,
                Date d)
Constructor
Parameters:
c - the column
r - the row
d - the date

DateTime

public DateTime(int c,
                int r,
                Date d,
                CellFormat st)
Constructor which takes the format for this cell
Parameters:
c - the column
r - the row
d - the date
st - the format

DateTime

public DateTime(int c,
                int r,
                Date d,
                CellFormat st,
                boolean tim)
Constructor which takes the format for the cell and an indicator as to whether this cell is a full date time or purely just a time eg. if the spreadsheet is to contain the world record for 100m, then the value would be 9.83s, which would be indicated as just a time
Parameters:
c - the column
r - the row
d - the date
st - the style
tim - flag indicating that this represents a time

DateTime

public DateTime(int c,
                int r,
                Date d,
                CellFormat st,
                jxl.write.biff.DateRecord.GMTDate a)
Constructor, which adjusts the specified date to take timezone considerations into account
Parameters:
c - the column
r - the row
d - the date
st - the cell format
a - the cummy overload

DateTime

public DateTime(int c,
                int r,
                Date d,
                jxl.write.biff.DateRecord.GMTDate a)
Constructor, which adjusts the specified date to take timezone considerations into account
Parameters:
c - the column
r - the row
d - the date
a - dummy overload

DateTime

public DateTime(DateCell dc)
A constructor called by the worksheet when creating a writable version of a spreadsheet that has been read in
Parameters:
dc - the date to copy

Method Details

copyTo

public WritableCell copyTo(int col,
                           int row)
Implementation of the deep copy function
Specified by:
copyTo in interface WritableCell
Parameters:
col - the column which the new cell will occupy
row - the row which the new cell will occupy
Returns:
a copy of this cell, which can then be added to the sheet

setDate

public void setDate(Date d)
Sets the date for this cell
Parameters:
d - the date

setDate

public void setDate(Date d,
                    jxl.write.biff.DateRecord.GMTDate a)
Sets the date for this cell, performing the necessary timezone adjustments
Parameters:
d - the date
a - the dummy overload