org.bidib.wizard.common.utils.TimeConversionUtils Maven / Gradle / Ivy
package org.bidib.wizard.common.utils;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
public final class TimeConversionUtils {
public static LocalDate convertDateToLocalDate(Date dateToConvert) {
return dateToConvert.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
public static LocalDateTime convertMillisToLocalDateTime(long millis) {
return Instant.ofEpochMilli(millis).atZone(ZoneId.systemDefault()).toLocalDateTime();
}
}