Common

Date Handing

Reflection

IO

HTTP Request

Cryptography

Date Type Conversion

DateTypeConvert converts legacy Date, Calendar, SQL date types, epoch milliseconds, and Java 8 java.time values. Supply a ZoneId whenever a conversion needs a civil time zone.

Instant instant = Instant.now();
ZoneId zone = ZoneId.of("Asia/Shanghai");

LocalDateTime local = new DateTypeConvert(instant).to(LocalDateTime.class, zone);
Calendar calendar = new DateTypeConvert(instant).to(Calendar.class, zone);

Important semantics

Instant epoch = new DateTypeConvert(0L).to(Instant.class, ZoneOffset.UTC);
assertEquals(Instant.EPOCH, epoch);

If no input has been set or a conversion is inherently ambiguous, the API throws an exception instead of silently inventing missing context.