schangxiang@126.com
2025-03-10 8706d6948d9a922d8e5adce27f49790ad4ac1d71
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;
};