I have a time.Time variable in Golang 10-30 00:49:07.1236
that needs to be converted to a Go Protobuf timestamp.Timestamp. Any idea on what functions can be used to accomplish this? Or am I looking at this from the wrong angle?
See New
and Timestamp.AsTime
in timestamppb
These support conversion to/from time.Time
and Timestamp
Try using the timestamppb.New
like this:
newTimeStamp:=timestamppb.New(your_time)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With