From 3499f939f9eda2c07fa25dcb9be3a747843b0885 Mon Sep 17 00:00:00 2001 From: Joerg Lehmann Date: Mon, 5 Apr 2021 11:02:21 +0200 Subject: [PATCH] csv with local time --- metrics.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metrics.go b/metrics.go index d663291..092aef0 100644 --- a/metrics.go +++ b/metrics.go @@ -305,6 +305,7 @@ func downloadmetricsHandler(response http.ResponseWriter, request *http.Request) log.Fatal("Error reading body. ", err) } fmt.Println("response Body:", string(body)) + location, err := time.LoadLocation("Europe/Zurich") scanner := bufio.NewScanner(strings.NewReader(string(body))) @@ -317,7 +318,7 @@ func downloadmetricsHandler(response http.ResponseWriter, request *http.Request) fmt.Printf("error converting time: %s\n", s[3]) continue } - mytime := t.Format("02.01.2006 15:04") + mytime := t.In(location).Format("02.01.2006 15:04") fmt.Fprintf(response, "\"%s\",%s,%s\n", mytime, s[8], s[9]) }