Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

207
Views
Date from .xlsx automatically getting converted into 5 digit number

I am trying to take data from xls and upload it to database(sql), in the xls I have a date column in format dd-mm-yyyy, but it is somehow getting converted to 5 digit number and sql is throwing error "Incorrect date value: '43831' for column 'date_of_birth' at row 1".

JS format : date; SQL format : date;

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Excel stores it's dates as the number of days since Jan 1 1900, Javascript uses a system similar to unix time, 1 Jan 1970, but use milliseconds instead of days.

So using this info, a quick conversion should look something like ->

const excelEpoc = new Date(1900, 0, -1).getTime();
const msDay = 86400000;

function excelDateToJavascript(excelDate) {
  return  new Date(excelEpoc + excelDate * msDay);
}

console.log(excelDateToJavascript(43831));

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!