在golang中解析大写字母月份

I want to parse string like "25-APR-2019" to time.time

I know parsing date using

date, err := time.Parse(layout, stringVariableForDate)

But I didn't find layout option in https://golang.org/pkg/time/#pkg-constants

I can not use JAN, as using this, I am getting error :

panic: parsing time "25-APR-2019" as "02-JAN-2006": cannot parse "APR-2019" as "-JAN-"

How can I parse date string with month name in capital letter in go-lang?

Package time

import "time" 

The recognized month formats are "Jan" and "January".


The parse layout abbreviated month format is "Jan". Use "02-Jan-2006" for the parse layout.

For example,

package main

import (
    "fmt"
    "time"
)

func main() {
    date, err := time.Parse("02-Jan-2006", "25-APR-2019")
    fmt.Println(date, err)
}

Playground: https://play.golang.org/p/5MRpUrUVJt4

Output:

2019-04-25 00:00:00 +0000 UTC <nil>