用子方法解析日期

I'm aware of the time package and how you can parse templates based on date/time representation. What I would like to know is how to parse time.Now() one month prior to stdLongMonth.

i.e.

time.Now() // == April, 2013
// Output: March, 2013

In other words, is it possible to parse time.now() with a sub.stdLongMonth() method? Can anyone be kind enough and show some examples?

For example,

package main

import (
    "fmt"
    "time"
)

func main() {
    y, m, _ := time.Now().Date()
    t := time.Date(y, m, 1, 0, 0, 0, 0, time.UTC)
    fmt.Println(t.Format("January, 2006"))
    t = time.Date(y, m-1, 1, 0, 0, 0, 0, time.UTC)
    fmt.Println(t.Format("January, 2006"))
}

Output:

April, 2013
March, 2013

use time.AddDate() as this will also free you from timezone considerations:

package main

import (
    "fmt"
    "time"
)

func main() {
    time := time.Now().AddDate(0,-1,0)
    fmt.Println(time.Format("January, 2006"))

}