package formatime import ( "encoding/json" "log" "testing" ) type joo struct { Name string `json:"name"` CreatedAt CustomTime `json:"created_at"` } func Test_customize(t *testing.T) { b := joo{ Name: "Joo", CreatedAt: NewCustomTimeNow("Jan _2 15:04:05.000000000"), } text, err := json.Marshal(&b) if err != nil { t.Fatal(err) } else { log.Print(string(text)) } }