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

leisure.springboot.excell.ConvertOfT2S Maven / Gradle / Ivy

The newest version!
package leisure.springboot.excell;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import leisure.core.common.TimeUtil;

/**
 * 时间戳转字符串日期
 *
 * @author zcx
 * @date 2024/1/16 17:20
 **/
public class ConvertOfT2S implements Converter {

    @Override
    public Class supportJavaTypeKey() {
        return Converter.super.supportJavaTypeKey();
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return Converter.super.supportExcelTypeKey();
    }

    @Override
    public WriteCellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        String re = TimeUtil.stamp2Date(value * 1000L);
        return new WriteCellData<>(re);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy