{{ message }}
4279: honour session timezone in FROM_UNIXTIME#4280
Draft
bheading wants to merge 1 commit into
Draft
Conversation
katzyn
reviewed
Sep 7, 2025
katzyn
left a comment
Contributor
There was a problem hiding this comment.
Thank you for your contribution!
Please, address the review comments and send a license statement as described here
https://h2database.com/html/build.html#providing_patches
to the mailing list (Google group):
https://groups.google.com/g/h2-database
| public static String fromUnixTime(int seconds, String format) { | ||
| public static String fromUnixTime(SessionLocal session, int seconds, String format) { | ||
| format = convertToSimpleDateFormat(format); | ||
| SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ENGLISH); |
Contributor
There was a problem hiding this comment.
SimpleDateFormat and Date are legacy defective by design classes, please, replace them with classes from JSR-310.
Something like
DateTimeFormatter.ofPattern(format).withLocale(Locale.ENGLISH).withZone(ZoneId.of(session.currentTimeZone().getId()))
.format(Instant.ofEpochSecond(seconds));You also need to adjust tests it TestCompatibility, they must set some specific time zone of the session.
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #4279
A quick hack that demonstrates the problem - let me know if you want me to change the approach or add test cases etc.