Closed pedroalbanese closed 3 years ago
I think that's what you're looking for: https://pkg.go.dev/github.com/google/uuid#UUID.Time
@lvndry is correct, just do: fmt.Printf("%v\n", uuid.Time())
buf := new(bytes.Buffer)
buf.ReadFrom(lreader)
s := buf.String()
uuid, _ := uuid.Parse(s)
fmt.Printf("Successfully parsed UID : %s\n", uuid)
id := uuid
t := id.Time()
sec, nsec := t.UnixTime()
timeStamp := time.Unix(sec, nsec)
fmt.Printf("The id was generated at : %v \n", timeStamp.Format("2006-01-02 Mon 15:04:05.000Z -0700"))```
is your time right after parse? this is my test code and result
timeGenerated := time.Unix(uuid.New().Time().UnixTime())
fmt.Printf("timeGenerated=%d, %s", timeGenerated.Unix(), timeGenerated.Format(time.DateTime))
timeGenerated=64592788894, 4016-11-12 01:21:34
Greetings !!
How do I print the time of the parsed UUID?
Thanks in advance.