From faf9eda72c3ac1306d5ee4768dbe4ce47cab10bb Mon Sep 17 00:00:00 2001 From: elbert-widjaja Date: Mon, 20 Jun 2022 14:05:54 +0800 Subject: [PATCH] fix datetime xls for yyyy/mm/dd hh/mm/ss --- col.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/col.go b/col.go index 8636566..70c33a0 100644 --- a/col.go +++ b/col.go @@ -11,6 +11,8 @@ import ( yymmdd "github.com/extrame/goyymmdd" ) +const DDMMYYYYhhmmss = "2006-01-02 15:04:05" + //content type type contentHandler interface { String(*WorkBook) []string @@ -170,6 +172,9 @@ type NumberCol struct { func (c *NumberCol) String(wb *WorkBook) []string { if fNo := wb.Xfs[c.Index].formatNo(); fNo != 0 { t := timeFromExcelTime(c.Float, wb.dateMode == 1) + if fNo == 176 { + return []string{t.Format(DDMMYYYYhhmmss)} + } return []string{yymmdd.Format(t, wb.Formats[fNo].str)} } return []string{strconv.FormatFloat(c.Float, 'f', -1, 64)}