Specify cell timestamp layout for CSV export, #163

This commit is contained in:
Dan Sosedoff
2016-06-27 22:38:48 -05:00
parent f575441aa6
commit 790833dc4e

View File

@@ -7,6 +7,7 @@ import (
"fmt"
"reflect"
"strconv"
"time"
)
type Row []interface{}
@@ -83,7 +84,12 @@ func (res *Result) CSV() []byte {
for i, item := range row {
if item != nil {
record[i] = fmt.Sprintf("%v", item)
switch v := item.(type) {
case time.Time:
record[i] = v.Format("2006-01-02 15:04:05")
default:
record[i] = fmt.Sprintf("%v", item)
}
} else {
record[i] = ""
}