Java 8
You can use a ZonedDateTime
set to UTC and then translate it to a LocalDateTime
using something like...
java.sql.Timestamp ts = resultSet.getTimestamp("VisitDate");
ZonedDateTime utcDateTime = ZonedDateTime.ofInstant(ts.toInstant(), ZoneId.of("UTC"));
LocalDateTime localDateTime = utcDateTime.withZoneSameInstant(ZoneId.systemDefault()).toLocalDateTime();
Obviously, I've use ZoneId.systemDefault()
in the example (convert the zoned date/time to local date/time), but you can pass what ever zone you want/need
Joda-Time
And similarly with Joda-Time if you're not using Java 8
java.sql.Timestamp ts = resultSet.getTimestamp("VisitDate");
LocalDateTime utcDateTime = new LocalDateTime(ts, DateTimeZone.UTC);
DateTime hereDateTime = utcDateTime.toDateTime(DateTimeZone.getDefault());