标题返回时间年月日
export const getDate = ( ) => {
const date = new Date ( ) ;
let year = date. getFullYear ( ) ;
let month = date. getMonth ( ) + 1 ;
month = month < 10 ? ` 0 ${ month} ` : month;
let day = date. getDate ( ) ;
day = day < 10 ? ` 0 ${ day} ` : day;
let value = ` ${ year} - ${ month} - ${ day} ` ;
return value
}
export const getTime = ( ) => {
const date = new Date ( ) ;
let year = date. getFullYear ( ) ;
let month = date. getMonth ( ) + 1 ;
month = month < 10 ? ` 0 ${ month} ` : month;
let day = date. getDate ( ) ;
day = day < 10 ? ` 0 ${ day} ` : day;
let hours = date. getHours ( ) ;
hours = hours < 10 ? ` 0 ${ hours} ` : hours;
let minutes = date. getMinutes ( ) ;
minutes = minutes < 10 ? ` 0 ${ minutes} ` : minutes;
let seconds = date. getSeconds ( ) ;
seconds = seconds < 10 ? ` 0 ${ seconds} ` : seconds;
let time = ` ${ year} - ${ month} - ${ day} ${ hours} : ${ minutes} : ${ seconds} ` ;
return time;
}
export const yearAndMonth = ( ) => {
const date = new Date ( ) ;
let year = date. getFullYear ( ) ;
let month = date. getMonth ( ) + 1 ;
month = month < 10 ? ` 0 ${ month} ` : month;
return year + "" + month;
}