We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Weird Date issue in Spreadsheet


I have the above spreadsheet. When I am using getData method, Date is coming as 44945. How is this possible ?

Here is the code I am using

var usedRange = spreadsheet.getActiveSheet().usedRange;

var selIndex = [1, 0, usedRange.rowIndex, usedRange.colIndex];

var range = spreadsheet.getActiveSheet().name + '!' + ej.spreadsheet.getRangeAddress([1, 0, selIndex[2], selIndex[3]]);

  var rows = [];

  var obj = {};

        spreadsheet.getData(range).then(data => {

            data.forEach((cell, key) => {

                var indexes = ej.spreadsheet.getRangeIndexes(key);

                if (cell && selIndex[2] >= indexes[0]) {

                    // constructing the key value object

                    if (key.indexOf('A') > -1) {

                        obj['trade_id'] = cell.value;

                    } else if (key.indexOf('B') > -1) {

                        var date = new Date(cell.value);



                        obj['trade_date'] = moment.utc(cell.value).format("MM/DD/YYYY");

                    } else if (key.indexOf('C') > -1) {

                        obj['settlement_date'] = moment.utc(cell.value).format("MM/DD/YYYY");

                    } else if (key.indexOf('D') > -1) {

                        obj['trade_type'] = cell.value;




2 Replies

RL Ram Lanka February 6, 2023 07:41 PM UTC

Also, I see the issue here too 


Click on SavAsJson on top and open console.

SP Sangeetha Priya Murugan Syncfusion Team February 8, 2023 06:39 AM UTC

Hi Ram,

We have maintained the parsed value for date-formatted values in the "value" property and the formatted string in the "format" property of the cellModel. Therefore, we suggest that you use the getDisplayText method to get the displayed value of the cell. It is not an issue on our end; if we open the same JSON in a spreadsheet, it applies the date formats as they are. Alternatively, if you export that JSON to Excel, it is exported properly. Please find the API link below.

API Link: https://ej2.syncfusion.com/documentation/api/spreadsheet#getdisplaytext

Live Chat Icon For mobile
Up arrow icon