ActiveXObject date formatting

ActiveXObject always return JAVASCRIPT date format. In order to format it for your requirement, we can get the month, date and year to format it.

Sample Code:

if ( String(XLSheet.Cells(rowIndex, colIndex).value).indexOf(' UTC') != -1 || String(XLSheet.Cells(rowIndex, colIndex).value).indexOf(' GMT') != -1) {
 var dt = new Date(XLSheet.Cells(rowIndex, colIndex).value);
 var st = (dt.getMonth() + 1).toString() + '/' + dt.getDate() + '/' + dt.getYear();
}

here st returns the date in MM/DD/YYYY format.

Leave a Reply