java - check the correctness of the excel date using poi -


i reading excel sheet using poi has date column. want check correctness of date example if date entered in excel 05/45/2015. no month has 45 days in it. wondering there built in method available.

this didn't print invalid date

if(dateutil.iscelldateformatted(cell)) {       system.out.println("cell value-->"+cell.getdatecellvalue()); } else{      system.out.println("invalid date");  } 

this code converts date 06/45/2015 06/30/2015

simpledateformat sdf = new simpledateformat("mm/dd/yyyy");  string  s =  sdf.format(cell.getdatecellvalue()); system.out.println(s); 

i don't want such conversions.

you can simpledateformat class

 //string date = "05/45/2015";  string date = dateformatter.formatcellvalue(cell);   dateformat df = new simpledateformat("mm/dd/yyyy");   try {       date d= df.parse(date);       //if didnt exception date in correct format  }catch (exception e) {       //date not in correct format       return false;  } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -