From 6f8d31150fe6d1117906bcb92e01ebd6e402d155 Mon Sep 17 00:00:00 2001 From: haoyanbin <605649647@qq.com> Date: Mon, 11 Sep 2023 17:45:33 +0800 Subject: [PATCH] 1 --- api/mobile/survey.go | 2 +- utils/common.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/api/mobile/survey.go b/api/mobile/survey.go index 2a08f0a..8294179 100755 --- a/api/mobile/survey.go +++ b/api/mobile/survey.go @@ -187,7 +187,7 @@ func ExportSurveyUserExcel(c *gin.Context) { f.SetCellValue(fileName, "C"+a, region) f.SetCellValue(fileName, "D"+a, city) f.SetCellValue(fileName, "E"+a, v.CZone) - f.SetCellValue(fileName, "F"+a, v.CreateTime) + f.SetCellValue(fileName, "F"+a, utils.StringToTime(v.CreateTime)) f.SetCellValue(fileName, "G"+a, optionData) f.SetCellValue(fileName, "H"+a, "") f.SetCellValue(fileName, "I"+a, "") diff --git a/utils/common.go b/utils/common.go index 8a4df69..a9e3485 100644 --- a/utils/common.go +++ b/utils/common.go @@ -92,6 +92,18 @@ func Time2Str(timeVal time.Time) string { return strTime } +func StringToTime(data string) string { + to, _ := time.Parse("2006-01-02T15:04:05+08:00", data) + + strTime := to.Format("2006-01-02 15:04:05") + + if strTime == "0001-01-01 00:00:00" { + strTime = "" + } + + return strTime +} + func Time2StrHMS(timeVal int) string { s := timeVal % 60 if timeVal/60 == 0 { -- 2.18.1