I have an issue with a program i want to code. I would like to enter a date , and find the Excel numeric representation using POI libraries. I would like later to search in a Excel table for this specific date. Here my code:
import java.util.*;
import java.util.Date;
import java.text.*;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFRow;
public class readExcel {
static double exDate;
public static void main( String [] args ) {
try{
Scanner user_input = new Scanner(System.in);
/*Enter the date and capture it*/
String Date_Choice;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
System.out.println("\n");
System.out.print("Enter your date choice (yyyy/mm/dd): ");
Date_Choice = user_input.next();
System.out.println("You chose the following date: " + Date_Choice);
Date d = sdf.parse(Date_Choice);
exDate = getExcelDate(d);
System.out.println(exDate);
}
catch (ParseException ex) {
ex.printStackTrace();
}
/*convert the datae into an integer*/
HSSFDateUtil.parseYYYYMMDDDate(Date_Choice);
}
}
I have those issues: the compile does not the getExcelDate method . Also at the last line of code , the Date_Choice variable which is a string ing not recognised. when i run the code , I have the following compiling error:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - erroneous sym type: getExcelDate
at readExcel.main(readExcel.java:44)
Java Result: 1
Line 44 is : exDate = getExcelDate(d);
I believe to have the proper libraries.. Please can I have some advice?