Skip to content

Commit

Permalink
Allow conversion from OffsetDateTime to java.sql.Timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
clemens-ruettermann-viadee committed Nov 6, 2024
1 parent 23a88d5 commit 7fc3a6f
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.sql.Timestamp;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.Year;
import java.time.ZoneId;
import java.time.ZoneOffset;
Expand Down Expand Up @@ -838,6 +839,8 @@ protected java.sql.Timestamp convertObjectToTimestamp(Object sourceObject) throw
timestamp = Helper.timestampFromLong((Long)sourceObject);
} else if (sourceObject instanceof LocalDateTime) {
timestamp = Timestamp.valueOf((LocalDateTime) sourceObject);
} else if (sourceObject instanceof OffsetDateTime) {
timestamp = Timestamp.valueOf(((OffsetDateTime)sourceObject).toLocalDateTime());
} else {
throw ConversionException.couldNotBeConverted(sourceObject, ClassConstants.TIMESTAMP);
}
Expand Down

0 comments on commit 7fc3a6f

Please sign in to comment.