简体   繁体   中英

Reading date in a format from excel irrespective of systems date format using apache poi

I am reading records from excel and inserting it in databases. There are date fields in the excel. I have given the functionality such that the user can define the format of date in excel that he is uploading. Consider a case where user specifies the date in excel to be as dd/mm/yyyy , Now suppose there is a date in excel such as 2/5/1993. Ideally the date should be read as 2 May 1993, but apache poi in my case is reading as 5 feb 1993 because the systems date is set to be in MM/dd/YYYY. Is there any way to tell apache POI to accept date format irrespective of the machines date format. Thanks

Apache POI具有DateFormatConverter类,该类使用某些Locale的指定模式在excel中格式化日期。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM