com.seepine.mybatis.converter.LocalDateTimeConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-boot-starter-mybatis Show documentation
Show all versions of spring-boot-starter-mybatis Show documentation
Spring Boot Mybatis Dependencies
The newest version!
package com.seepine.mybatis.converter;
import com.seepine.mybatis.JacksonConfig;
import org.springframework.core.convert.converter.Converter;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
/**
* @author seepins
*/
public class LocalDateTimeConverter {
public static class StringToLocalDateTimeConverter implements Converter {
@Override
public LocalDateTime convert(String s) {
DateTimeFormatter formatter =
DateTimeFormatter.ofPattern(JacksonConfig.NORM_DATETIME_PATTERN, Locale.CHINESE);
return LocalDateTime.parse(s, formatter);
}
}
public static class StringToLocalDateConverter implements Converter {
@Override
public LocalDate convert(String s) {
DateTimeFormatter formatter =
DateTimeFormatter.ofPattern(JacksonConfig.NORM_DATE_PATTERN, Locale.CHINESE);
return LocalDate.parse(s, formatter);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy