From b1d33fd41ee85b3100859764f7630fee3c205fab Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期六, 02 十一月 2024 15:43:17 +0800
Subject: [PATCH] 计划数据

---
 src/utils/dateUtil.ts |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/utils/dateUtil.ts b/src/utils/dateUtil.ts
index b83c3a5..658f0a1 100644
--- a/src/utils/dateUtil.ts
+++ b/src/utils/dateUtil.ts
@@ -21,3 +21,20 @@
 }
 
 export const dateUtil = dayjs
+
+export function getYMDHMS (timestamp: number | string | Date) {
+  const time = new Date(timestamp)
+  const year = time.getFullYear()
+  let month = time.getMonth() + 1 + ''
+  let date = time.getDate() + ''
+  let hours = time.getHours() + ''
+  let minute = time.getMinutes() + ''
+  let second = time.getSeconds() + ''
+
+  if (month < 10) { month = '0' + month }
+  if (date < 10) { date = '0' + date }
+  if (hours < 10) { hours = '0' + hours }
+  if (minute < 10) { minute = '0' + minute }
+  if (second < 10) { second = '0' + second }
+  return year + '-' + month + '-' + date + ' ' + hours + ':' + minute + ':' + second
+}

--
Gitblit v1.9.3