protobuf timestamp: Use Java 8 time.Instant

java.time.Instant to com.google.protobuf.Timestamp :

com.google.protobuf.Timestamp.newBuilder()
    .setSeconds(myInstant.getEpochSecond())
    .setNanos(myInstant.getNano());

com.google.protobuf.Timestamp to java.time.Instant :

Instant.ofEpochSecond(myProtoTimestamp.getSeconds(), myProtoTimestamp.getNanos());

Instant instant = Instant.ofEpochSecond(timestamp.getSeconds(), timestamp.getNanos());

If anyone's writing in Kotlin, Louis' answer can be implemented as an extension function like this:

fun Timestamp.toInstant(): Instant = Instant.ofEpochSecond(seconds, nanos.toLong())

Then you can just do myProto.myTimestampField.toInstant()