Class ProtoTimestamps
- java.lang.Object
-
- org.curioswitch.common.server.framework.util.ProtoTimestamps
-
public final class ProtoTimestamps extends java.lang.Object
Common utilities for dealing withTimestamp
, such as conversion tojava.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 aInstant
toTimestamp
.static com.google.protobuf.Timestamp
fromLocalDate(java.time.LocalDate localDate, java.time.ZoneOffset zone)
Converts aLocalDate
toTimestamp
.static com.google.protobuf.Timestamp
fromLocalDateTime(java.time.LocalDateTime localDateTime, java.time.ZoneOffset zone)
Converts aLocalDateTime
toTimestamp
.static java.time.Instant
toInstant(com.google.protobuf.Timestamp timestamp)
Converts aTimestamp
toInstant
.static java.time.LocalDate
toLocalDate(com.google.protobuf.Timestamp timestamp, java.time.ZoneOffset zone)
Converts aTimestamp
toLocalDate
.static java.time.LocalDateTime
toLocalDateTime(com.google.protobuf.Timestamp timestamp, java.time.ZoneOffset zone)
Converts aTimestamp
toLocalDateTime
.
-
-
-
Method Detail
-
toLocalDateTime
public static java.time.LocalDateTime toLocalDateTime(com.google.protobuf.Timestamp timestamp, java.time.ZoneOffset zone)
Converts aTimestamp
toLocalDateTime
.
-
fromLocalDateTime
public static com.google.protobuf.Timestamp fromLocalDateTime(java.time.LocalDateTime localDateTime, java.time.ZoneOffset zone)
Converts aLocalDateTime
toTimestamp
.
-
toLocalDate
public static java.time.LocalDate toLocalDate(com.google.protobuf.Timestamp timestamp, java.time.ZoneOffset zone)
Converts aTimestamp
toLocalDate
. This will be the date that includes theTimestamp
.
-
fromLocalDate
public static com.google.protobuf.Timestamp fromLocalDate(java.time.LocalDate localDate, java.time.ZoneOffset zone)
Converts aLocalDate
toTimestamp
. This will be theTimestamp
at the start of the day.
-
toInstant
public static java.time.Instant toInstant(com.google.protobuf.Timestamp timestamp)
Converts aTimestamp
toInstant
.
-
fromInstant
public static com.google.protobuf.Timestamp fromInstant(java.time.Instant instant)
Converts aInstant
toTimestamp
.
-
-