Converting Number representation of Date in excel to Date in java

前端 未结 4 502
暖寄归人
暖寄归人 2020-11-30 10:05

I have date column in excel, but when I\'m reading in my java application I\'m getting value as number

Example

Excel Date

1/1/2013

4条回答
  •  感动是毒
    2020-11-30 10:51

    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
    

提交回复
热议问题