2
schangxiang@126.com
2024-12-17 44fcdab03ff6b1136af7504641a4254276c73b78
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/**
 *  @description 获取年月日  时分秒
 *  @returns {string}  yyyy-MM-dd hh:mm:ss
 */
export function getDate() {
  const date = new Date();
  let str = date.getFullYear() + '-' + addZero(date.getMonth() + 1) + '-' + addZero(date.getDate());
 
  // if (option && option.full) {
    str += ' ' + addZero(date.getHours()) + ':' + addZero(date.getMinutes()) + ':' + addZero(date.getSeconds());
  // }
  return str;
}
const addZero = function(date) {
  return date > 9 ? date : '0'+date;
};