Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Excel serial date numbers to date (Java?)

Niek VerbartMay 29 2015 — edited Jun 1 2015

Hi,

We use a lot of templates and people are copy/pasting from other files into the templates. Unfortunately it cauases problems. EDQ does not always recognize the real date but only the excel serial number for the date. Ofcourse, we need to structually resolve this by looking at the processes/settings. But for now, I would like to build a quick fix.

How can I convert Excel serial number dates (type: string) to normal dates (type: date). I've used google and seen a couple of basic Javascript coding that will do the job, but these won't work properly in EDQ.

For example a basic code:

function ExcelDateToJSDate(serial) {

   var utc_days = Math.floor(serial - 25569);

   var utc_value = utc_days * 86400;                                       

   var date_info = new Date(utc_value * 1000);

   var fractional_day = serial - Math.floor(serial) + 0.0000001;

   var total_seconds = Math.floor(86400 * fractional_day);

   var seconds = total_seconds % 60;

   total_seconds -= seconds;

   var hours = Math.floor(total_seconds / (60 * 60));

   var minutes = Math.floor(total_seconds / 60) % 60;

   return new Date(date_info.getFullYear(), date_info.getMonth(), date_info.getDate(), hours, minutes, seconds);

}

Thanks for helping out and pointing me in the right direction.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 29 2015
Added on May 29 2015
4 comments
2,367 views