Java apache poi to read exact date format as mentioned in excel -


this question has answer here:

i have seen link apache poi dataformatter on cell containing date solution updated "dd/mm/yyyy" format using simpledateformat dtformat = new simpledateformat("dd/mm/yyyy"); in case i'm not aware of format..it may in date format. in case how can handle?

i have tried read date value date cell in xlsx file.

cell having data as: 8/5/2016

output im getting : 8/5/16

i need same format mentioned in date cell.

if know format can use simpledateformat dtformat = new simpledateformat("dd/mm/yyyy"). without knowing format there way it?

sample code:

int r1c1=5; switch (cell.getcelltype())  { case xssfcell.cell_type_numeric:        if (hssfdateutil.iscelldateformatted(cell)){         dataformatter formatter = new dataformatter();         //value variable displaying output 8/5/16 instead of 8/5/2016         value = formatter.formatcellvalue(cell);         hm.put(r1c1, value); //using hashmap store value     }     break; } 


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -