Converting number representing a date in Excel to a Java Date object

Here is a minimal working example how to convert an Excel date to a Java date:

        Date javaDate= DateUtil.getJavaDate((double) 41275.00);
        System.out.println(new SimpleDateFormat("MM/dd/yyyy").format(javaDate));

which returns

01/01/2013

You also need to import the following packages:

java.text.SimpleDateFormat
java.util.Date

Leave a Comment