Quantcast
Channel: Java Programming Forum - Learn Java Programming - Apache POI
Viewing all articles
Browse latest Browse all 120

Read Date from Excel and change its Format

$
0
0
Hello,

i have excel file and i want to reat some column and insert it in Db, any way i want to read Column with date
Code:

Date
========
14.12.2010
15.12.2010
16.12.2010
17.12.2010
18.12.2010
19.12.2010
20.12.2010
21.12.2010
22.12.2010

Code:

public class Date_DB {
   
    private String name;
    private Date dateOfCommission;
  //Setters und Getters

Calss To read from Excel
Code:

Date_DB pp = new Date_DB();
pp.setDateOfCommission(row.getCell(12).getDateCellValue());  ///date
set.add(pp);

But it reads the Date as the flowing:
Code:

Tue Dec 14 00:00:00 CET 2010
Wed Dec 15 00:00:00 CET 2010
Thu Dec 16 00:00:00 CET 2010
Fri Dec 17 00:00:00 CET 2010
Sat Dec 18 00:00:00 CET 2010
Sun Dec 19 00:00:00 CET 2010
Mon Dec 20 00:00:00 CET 2010
Tue Dec 21 00:00:00 CET 2010
Wed Dec 22 00:00:00 CET 2010

Now what i wish is to reformat this Date to be exactly like in the Excel file (have Format ""dd.MM.yyyy" ) and store them ad a Date in the Set

I read a lot about Calender Format, but i didn't find any thing really helpful

Any Help?

Viewing all articles
Browse latest Browse all 120

Trending Articles