All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.ipokerface.web.spring.converter.LocalDateTimeConverter Maven / Gradle / Ivy

The newest version!
package cn.ipokerface.web.spring.converter;

import cn.ipokerface.common.utils.LocalTimeUtils;
import cn.ipokerface.common.utils.StringUtils;
import org.springframework.core.convert.converter.Converter;

import java.time.LocalDateTime;

public class LocalDateTimeConverter implements Converter {


    @Override
    public LocalDateTime convert(String s) {
        if (StringUtils.isEmpty(s)) return null;
        try{
            Long longValue = Long.parseLong(s);
            return LocalTimeUtils.parse(longValue);
        }catch (Exception e){

        }
        return LocalTimeUtils.parse(s);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy