csv with local time

This commit is contained in:
Joerg Lehmann 2021-04-05 11:02:21 +02:00
parent 37d1d35afa
commit 3499f939f9
1 changed files with 2 additions and 1 deletions

View File

@ -305,6 +305,7 @@ func downloadmetricsHandler(response http.ResponseWriter, request *http.Request)
log.Fatal("Error reading body. ", err) log.Fatal("Error reading body. ", err)
} }
fmt.Println("response Body:", string(body)) fmt.Println("response Body:", string(body))
location, err := time.LoadLocation("Europe/Zurich")
scanner := bufio.NewScanner(strings.NewReader(string(body))) 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]) fmt.Printf("error converting time: %s\n", s[3])
continue 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]) fmt.Fprintf(response, "\"%s\",%s,%s\n", mytime, s[8], s[9])
} }