UNPKG

@zuiwoxing/posisi

Version:

一款基于typescript 前端控制组件,包括(IOC,AOP,Feign,Logger,Util等)

51 lines (50 loc) 1.74 kB
/** *@desc 日期工具类 *@author liudejian *@date 2020-01-13 17:47 **/ export declare class DateUtil { /** * 时间格式化 * @param time 后台时间长整型/date * @param fmt 时间格式 yyyy-MM-dd hh:mm:ss * @returns {*} */ static dateFormat(time: Date | number, fmt?: string): string; static formatDate(date: Date, format?: string): string; /** * 10秒: 10 * 1000 * 1分: 60 * 1000 * 1小时: 60 * 60 * 1000 * 24小时:60 * 60 * 24 * 1000 * 3天: 60 * 60* 24 * 1000 * 3 * * let data = new Date() * formatPast(data) // 刚刚 * formatPast(data - 11 * 1000) // 11秒前 * formatPast(data - 2 * 60 * 1000) // 2分钟前 * formatPast(data - 60 * 60 * 2 * 1000) // 2小时前 * formatPast(data - 60 * 60 * 2 * 1000) // 2小时前 * formatPast(data - 60 * 60 * 71 * 1000) // 2天前 * formatPast("2020-06-01") // 2020-06-01 * formatPast("2020-06-01", "YYYY-mm-dd HH:MM:SS WWW QQQQ") // 2020-06-01 08:00:00 星期一 第二季度 */ static formatPast(param: any, format?: string): string; /** * formatAxis(new Date()) // 上午好 */ static formatAxis(param: any): string; /** * 获取当前月第一天 */ static getMonthFirstDay(): Date; /** * 获取当前月最后一天 */ static getMonthLastDay(): Date; /** * 将时间秒转为HH:MM:SS * @param second 时间秒 */ static formatSecondToHms(second: any): string; }