on 05-25-2010 6:52 PM
Hi Friends,
I have one doubt on File upload. After downloading data into excel Sheet I have to modify some columns in the excel sheet then I am trying to upload same excel sheet to table.
I am getting problem in date column. I have written this code for upload excel file
boolean flag = false;
try
{
Path: here I am getting file from the server path
wb = Workbook.getWorkbook(new File(path)); // For Dev
Sheet sh = wb.getSheet(0);
int cloumns = sh.getColumns();
int row = sh.getRows();
int i = 0;
for(int j=1; j<row ; j++)
{
IPrivatePO_Details_ResultView.IPoDetails_OutTabElement ele = wdContext.nodePoDetails_OutTab().createPoDetails_OutTabElement();
ele.setChcekBoxEnable(true);
Cell c1 = sh.getCell(i,j);
ele.setPo_Number(c1.getContents());
BigDecimal bdStr = null;
Cell c7 = sh.getCell(i+6,j);
bdStr = new BigDecimal(c7.getContents());
ele.setQuantity(bdStr);
Cell c8 = sh.getCell(i+7,j);
bdStr = new BigDecimal(c8.getContents());
ele.setOa_Quantity(bdStr);
SimpleDateFormat smDate = smDate = new SimpleDateFormat("dd-MM-yyyy");
Date dt = null;
Cell c10 = sh.getCell(i+9,j);
*dt = (Date)smDate.parse(c10.getContents()); *
ele.setDeliv_Date(dt);
Cell c11 = sh.getCell(i+10,j);
dt = (Date)smDate.parse(c11.getContents());
ele.setStat_Date(dt);
Cell c14 = sh.getCell(i+13,j);
ele.setPo_Status(c14.getContents());
wdContext.nodePoDetails_OutTab().addElement(ele);
}
}
catch(Exception Ex)
{
Ex.printStackTrace();
}
Here PoDetails_OutTab this is value node under this value node Deliv_Date is available the date data type is date.
Please help me.
Regards
Vijay Kalluri
Hi Vijay,
Please check below code :-
Date dt = null;
SimpleDateFormat smDate = null;
smDate = new SimpleDateFormat("dd-MM-yyyy");
Cell c10 = sh.getCell(i+9,j);
dt = (Date)smDate.parse(c10.getContents());
ele.setDeliv_Date(dt);
Code if ok now. Please check the value for c10 using message manager and analyze the value that is ok for DATE or not.
Hope it helps
Regards
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Please use below code
patt="dd.mm.yyyy"
java.text.SimpleDateFormat backendformat;
backendformat = new SimpleDateFormat("yyyymmdd");
java.util.Date date_hired= null;
date_hired = backendformat.parse(hireddate);
backendformat.applyPattern(patt);
Regards
Dibya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Which Date type are u using- java.util.Date or java.sql.Date?
Regards,
Poojith MV
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.