Question

Date Convertion From Excel to DB

Hi,

I have a Rrequirement to Upload an Excel which i have to add two date fields in Excel. I have created Property type as text in pega and Column is a Date type in DB.

Now When i am adding a date in Excel it is Converting into Some Integer Value on Clipboard. Now i have to Convert that Integer whatever into Date Format and I have to Save the Data Into DB.

Ex: In Excel Column DATA Validity = 22-12-2018

it's converting as "45655" on to Clipboard.

Now This 45655 Value I have to Convert as 22-12-2018.

How can we Achieve this?

Note: I am Using OOTB Activity MSOParseExcel to read the Excel Data.

***Edited by Moderator: Pallavi to update platform capability tags***

Correct Answer
December 18, 2018 - 8:49am

Thank You For reply. Its Working Now.

your answer is also right. But we Were created New Java Function.

String DateVal =InputDate;

  try{
    double var= Double.parseDouble(DateVal);
    java.util.Date DateConv=org.apache.poi.ss.usermodel.DateUtil.getJavaDate(var);
    InputDate= new java.text.SimpleDateFormat("MM/dd/yyyy").format(DateConv);
    }
    catch(NumberFormatException e){
    InputDate=DateVal;
  }
return InputDate;

Comments

Keep up to date on this post and subscribe to comments

Pega
December 18, 2018 - 2:59am

December 18, 2018 - 8:49am
Response to inakh

Thank You For reply. Its Working Now.

your answer is also right. But we Were created New Java Function.

String DateVal =InputDate;

  try{
    double var= Double.parseDouble(DateVal);
    java.util.Date DateConv=org.apache.poi.ss.usermodel.DateUtil.getJavaDate(var);
    InputDate= new java.text.SimpleDateFormat("MM/dd/yyyy").format(DateConv);
    }
    catch(NumberFormatException e){
    InputDate=DateVal;
  }
return InputDate;