js excel in reading the date format conversion issues

When used to read excel js-xlsx plug, such data will be automatically loaded into 2018/10/16 48,264.12584511.

So the need to manually back again

// Excel format read 2018/01/01 this time it will be similar to a digital 46254.1545151415 numb is passed over an integer number, format is the symbol interval between 
    the formatDate (Numb, format) { 
      const Time = new new a Date ((Numb -. 1). 1 * 24 * 3600000 + ) 
      time.setYear (time.getFullYear () - 70 ) 
      const year = time.getFullYear () + '' 
      const month The = time.getMonth () +. 1 + ' ' 
      const DATE = time.getDate () -. 1 +' '
       IF (&& format.length === the format. 1 ) {
         return year + month The the format + + + the format DATE 
      } 
      return year + (month The <10' 0 '+? month: month) + (date <10 ? '0' + date : date)
    },
  console.log(
formatDate(42618, '/')) // 2016-9-5

About excel import and export as well as the specific method of use, please visit https://www.cnblogs.com/cazj/p/10912439.html

Guess you like

Origin www.cnblogs.com/cazj/p/10942875.html