ascor
Version:
一些常用的简单的js工具
16 lines (15 loc) • 599 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCurrentTime = void 0;
var dateFormat_1 = require("./dateFormat");
/**
* 获取当前时间 例:getCurrentTime(true)
* @param {Boolean | String} bool true返回时间戳,false返回Date实例,也可以传入格式化的字符串 如: ‘YYYY-mm-dd HH:MM:SS’
*/
exports.getCurrentTime = function (bool) {
if (bool === void 0) { bool = false; }
if (typeof bool == "string") {
return dateFormat_1.dateFormat(new Date(), bool);
}
return bool ? new Date().getTime() : new Date();
};