mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 19:36:43 +08:00
增加函数:formatDateShort
This commit is contained in:
@@ -148,6 +148,29 @@ export function formatDate(date){
|
||||
return newTime;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 把日期格式化为显示时间,yyyy-MM-dd
|
||||
* @param {Object} date
|
||||
*/
|
||||
export function formatDateShort(date){
|
||||
var year = date.getFullYear(),
|
||||
month = date.getMonth() + 1,//月份是从0开始的
|
||||
day = date.getDate(),
|
||||
hour = date.getHours(),
|
||||
min = date.getMinutes(),
|
||||
sec = date.getSeconds();
|
||||
if(month<10){month='0'+month}
|
||||
if(day<10){day='0'+day}
|
||||
if(hour<10){hour='0'+hour}
|
||||
if(min<10){min='0'+min}
|
||||
if(sec<10){sec='0'+sec}
|
||||
var newTime = year + '-' + month + '-' + day;
|
||||
return newTime;
|
||||
|
||||
}
|
||||
|
||||
|
||||
export function numberToLetter(x){ //此方法和移到utils中去
|
||||
let s = "";
|
||||
while (x > 0) {
|
||||
|
||||
Reference in New Issue
Block a user