package formatime import ( "encoding/json" "log" "testing" ) type boo struct { Name string `json:"name"` CreatedAt Timestamp `json:"created_at"` } func Test_timestamp(t *testing.T) { b := boo{ Name: "Boo", CreatedAt: NewTimestampNow(), } jsonText, err := json.Marshal(&b) if err != nil { t.Fatal(err) } else { log.Print(string(jsonText)) } }