excel date to javascript date

// function to convert excel date to normal js date  
excelDateToJSDate(excelDate) {
    var date = new Date(Math.round((excelDate - (25567 + 1)) * 86400 * 1000));
    var converted_date = date.toISOString().split('T')[0];
    return converted_date;
}

4.2
5
Aziz 75 points

                                    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);
}

4.2 (5 Votes)
0
4.5
2
Pukku 100 points

                                    /use excel-date-to-js

//Description
//Converts Excel date in integer format into JS date.
//Dates are stored as numbers in Excel
//and count the number of days since January 0, 1900 (1900 standard, for mac it is 1904, which means January 0, 1904 is the start date).
//Times are handled internally as numbers between 0 and 1.

//Install
//npm install -s excel-date-to-js
//Usage
const { getJsDateFromExcel } = require("excel-date-to-js");
getJsDateFromExcel("42510");
// 2016-05-20T00:00:00.000Z

4.5 (2 Votes)
0
3.89
9
M.ba 80 points

                                    var record_date = Date.parse(item.record_date_string)
var days = Math.round((record_date - new Date(1899, 11, 30)) / 8.64e7);
item.record_date = parseInt((days).toFixed(10));

return item;

3.89 (9 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
javascript how to convert date from excel javascript convert numbers excel to date how to convert date number from excel to js date how to read date from excel in javascript excel date format to js format excel date to js date convert excel date to js date how to convert excel date number to date js excel import data to date javascript js excel date number to date convert excel date number to date js javascript to date excel get date from excel document with js import date from excel to javascript javascript excel date to date javascript convert date excel dayjs convert date format js convert excel date to normal date convert javascript datetime to excel datetime convert excel time to javascript time convert js date to excel date excel time to javascript js to excel date date and time to show in excell from node js convert number excel to date js convert nuber excel to date js moment excel date convert datetime format js excel how to get the year from a date excel javascript when saving dattime to excel convert to number node js convert java datatime to excel datetime node js save string date time in excel as numbers using node js node js datatime excel convert excel date values to date format in javascript convert Date Serial Number to date in javascript javascript convert excel date date format convert excel data to js excel-date-to-js in angular excel date to javascript date excel date format to js date convert javascript date into excel date javascript date into excel format convert excel date to javascript date
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source