jxl problem with DateTime

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • basm101
    New Member
    • Sep 2007
    • 12

    #1

    jxl problem with DateTime

    I am trying to write a Date into an Excel spreadsheet using JExcel.

    However, this:

    Code:
    cell = new DateTime(columnIndex++, rowIndex, (Date) myDate);
    where columnIndex and rowIndex are integers and myDate is a Date like this:
    Sat Sep 01 15:00:00 BST 2007 (seen like this when writing out to System.out as a toString())

    I then add the cell to the spreadsheet

    Code:
    worksheet.addCell(cell);
    The problem is, an hour gets knocked off the date in the spreadsheet..

    e.g.

    01/09/2007 14:00 appears for the date Sat Sep 01 15:00:00 BST 2007

    Any ideas why ? I don't actually mind if I can get rid of the time in the spreadsheet alltogether and just keep the date. I have tried using DateFormat and converting cellData to a String and cutting off the time, but this just means the excel cell has a time of 00:00 and sometimes sets the date back by one day as well !

    please help..
    thanks
Working...