Class ProtoTimestamps


  • public final class ProtoTimestamps
    extends java.lang.Object
    Common utilities for dealing with Timestamp, such as conversion to java.time types.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.google.protobuf.Timestamp fromInstant​(java.time.Instant instant)
      Converts a Instant to Timestamp.
      static com.google.protobuf.Timestamp fromLocalDate​(java.time.LocalDate localDate, java.time.ZoneOffset zone)
      Converts a LocalDate to Timestamp.
      static com.google.protobuf.Timestamp fromLocalDateTime​(java.time.LocalDateTime localDateTime, java.time.ZoneOffset zone)
      Converts a LocalDateTime to Timestamp.
      static java.time.Instant toInstant​(com.google.protobuf.Timestamp timestamp)
      Converts a Timestamp to Instant.
      static java.time.LocalDate toLocalDate​(com.google.protobuf.Timestamp timestamp, java.time.ZoneOffset zone)
      Converts a Timestamp to LocalDate.
      static java.time.LocalDateTime toLocalDateTime​(com.google.protobuf.Timestamp timestamp, java.time.ZoneOffset zone)
      Converts a Timestamp to LocalDateTime.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toLocalDateTime

        public static java.time.LocalDateTime toLocalDateTime​(com.google.protobuf.Timestamp timestamp,
                                                              java.time.ZoneOffset zone)
        Converts a Timestamp to LocalDateTime.
      • fromLocalDateTime

        public static com.google.protobuf.Timestamp fromLocalDateTime​(java.time.LocalDateTime localDateTime,
                                                                      java.time.ZoneOffset zone)
        Converts a LocalDateTime to Timestamp.
      • toLocalDate

        public static java.time.LocalDate toLocalDate​(com.google.protobuf.Timestamp timestamp,
                                                      java.time.ZoneOffset zone)
        Converts a Timestamp to LocalDate. This will be the date that includes the Timestamp.
      • fromLocalDate

        public static com.google.protobuf.Timestamp fromLocalDate​(java.time.LocalDate localDate,
                                                                  java.time.ZoneOffset zone)
        Converts a LocalDate to Timestamp. This will be the Timestamp at the start of the day.
      • toInstant

        public static java.time.Instant toInstant​(com.google.protobuf.Timestamp timestamp)
        Converts a Timestamp to Instant.
      • fromInstant

        public static com.google.protobuf.Timestamp fromInstant​(java.time.Instant instant)
        Converts a Instant to Timestamp.