package com.foreverwin.mesnac.common.export;

import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.commons.lang.time.DateUtils;

public class DateShortConvert implements ColumnConvert {
    @Override
    public String convert(JSONObject row, String column, String value) {
        if (StrUtil.isBlank(value)) return "";
        //--------------------------------------------------------------------------------------------------------
        try {
            return DateFormatUtils.format(DateUtils.parseDate(value, DateConvert.patterns), "yyyy-MM-dd");
        } catch (Exception e) {
            ;
        }//try
        //--------------------------------------------------------------------------------------------------------
        return value;
    }
}
