I have the following code:
timeLocal := "01/July/2015:18:12:25 +0900"
inFormat := "02/January/2006:15:04:05 -0700"
parsed, err := time.Parse(inFormat, timeLocal)
if err != nil {
log.Fatal("Time format was not recognized!")
}
Now, parsing works fine. But when I run:
fmt.Println(timeLocal)
fmt.Println(inFormat)
fmt.Println(parsed)
The output is:
01/July/2015:18:12:25 +0900
02/January/2006:15:04:05 -0700
2015-07-01 18:12:25 +0900 +0900
Should the second +0900
be there? What is the stupid thing that I'm doing? Sorry, it was really a long day, I don't see what I'm missing.
Oh, and the whole file is here:
package main
import (
"fmt"
"time"
"log"
)
func main() {
timeLocal := "01/July/2015:18:12:25 +0900"
inFormat := "02/January/2006:15:04:05 -0700"
parsed, err := time.Parse(inFormat, timeLocal)
if err != nil {
log.Fatal("Time format was not recognized!")
}
fmt.Println(timeLocal)
fmt.Println(inFormat)
fmt.Println(parsed)
}