Home > front end >  Vue reads the excel found time to deal with
Vue reads the excel found time to deal with

Time:05-11

There are two kinds of circumstances, users to set time format is a text format, 2 is processed by the excel time format so need to decide what kind of format is under text format is simple so don't do sorting,

Cell time format processing

ExportDate (numb) {

The function formatTime (date) {

Return year + '-' + day of the month + '-' +;

}

If (numb & gt; 0) {//resolution first time

Const time=new Date ((numb - 1) * 24 * 3600000 + 1);

Let h=time. GetHours () + 16;

Let yeraData=https://bbs.csdn.net/topics/new Date (1900, 0, numb - 1)

Let year=yeraData. GetFullYear ();

Let the month=yeraData, getMonth () + 1

The month=month & lt; 10? '0' + month: the month;

Let day=yeraData. GetDate ()

Day=day & lt; 10? '0' + day: the day;

If (h & gt; 23) {

H=h - 24;

}

Let m=time getMinutes () & lt; 10? "0" + time. GetMinutes () : time. GetMinutes ();

Let s=time. GetSeconds () & lt; 10? "0" + time. GetSeconds () : time. GetSeconds ();

Return ` ${year} - ${month} - ${day} ${h} : ${m} : ${s} `;

} else {

//the console. The log (numb)

Return 'illegal date format;

}

}
  • Related