package com.canrd.webmagic.common.utils; import org.joda.time.DateTime; import java.time.LocalDateTime; /** * @author: xms * @description: TODO * @date: 2023/1/16 16:35 * @version: 1.0 */ public class LocalDateTimeUtil { /** * @param dateTime * @return */ public static LocalDateTime toLocalDateTime(DateTime dateTime) { return LocalDateTime.of(dateTime.getYear(), dateTime.getMonthOfYear(), dateTime.getDayOfMonth(), dateTime.getHourOfDay(), dateTime.getMinuteOfHour(), dateTime.getSecondOfMinute()); } /** * * @param localDateTime * @return */ public static DateTime toDateTime(LocalDateTime localDateTime) { return new DateTime().withYear(localDateTime.getYear()).withMonthOfYear(localDateTime.getMonthValue()) .withDayOfMonth(localDateTime.getDayOfMonth()).withHourOfDay(localDateTime.getHour()) .withMinuteOfHour(localDateTime.getMinute()).withSecondOfMinute(localDateTime.getSecond()); } }