Date parsing in Go

Viewed 22352

I'm trying to parse a timestamp as produced by tar such as '2011-01-19 22:15' but can't work out the funky API of time.Parse.

The following produces 'parsing time "2011-01-19 22:15": month out of range'

package main
import (
    "fmt"
    "time"
    )

func main () {
    var time , error = time.Parse("2011-01-19 22:15","2011-01-19 22:15")
    if error != nil {
        fmt.Println(error.String())
        return
        }
    fmt.Println(time)
    }
1 Answers
Related