org.simpleflatmapper.converter.impl.time.DateToJavaZonedDateTimeConverter Maven / Gradle / Ivy
package org.simpleflatmapper.converter.impl.time;
import org.simpleflatmapper.converter.Converter;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
public class DateToJavaZonedDateTimeConverter implements Converter {
private final ZoneId zoneId;
public DateToJavaZonedDateTimeConverter(ZoneId zoneId) {
this.zoneId = zoneId;
}
@Override
public ZonedDateTime convert(Date in) throws Exception {
if (in == null) return null;
return in.toInstant().atZone(zoneId);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy