首页>代码>ssm个人博客,包括登录注册,前端后台功能全面完整>/lingnanblog-/src/main/java/neusoft/controller/admin/DateJsonValueProcessor.java
package neusoft.controller.admin;

import java.text.SimpleDateFormat;

import net.sf.json.JsonConfig;
import net.sf.json.processors.JsonValueProcessor;

/**
 * json-lib 日期处理类xxxxx
 * @author Administrator
 *
 */
public class DateJsonValueProcessor implements JsonValueProcessor{

    private String format;

    public DateJsonValueProcessor(String format){
        this.format = format;
    }

    public Object processArrayValue(Object value, JsonConfig jsonConfig) {
        // TODO Auto-generated method stub
        return null;
    }

    public Object processObjectValue(String key, Object value, JsonConfig jsonConfig) {
        if(value == null)
        {
            return "";
        }
        if(value instanceof java.sql.Timestamp)
        {
            String str = new SimpleDateFormat(format).format((java.sql.Timestamp)value);
            return str;
        }
        if (value instanceof java.util.Date)
        {
            String str = new SimpleDateFormat(format).format((java.util.Date) value);
            return str;
        }

        return value.toString();
    }

}
最近下载更多
问耳朵  LV2 2023年12月14日
我是helloworld  LV23 2023年6月18日
monolog  LV4 2023年6月18日
微信网友_6495054193971200  LV2 2023年5月30日
zxc131313  LV12 2022年12月9日
刘鹏yyds  LV10 2022年11月23日
SCP11451  LV6 2022年10月10日
LJLljl002  LV5 2022年9月18日
 LV8 2022年6月6日
taoshen95  LV16 2022年5月6日
最近浏览更多
Yj123456k  LV2 5月12日
xiaoaitx  LV8 1月1日
ma406805131  LV19 2024年12月18日
dengge123  LV14 2024年12月13日
Wzzzccc 2024年10月21日
暂无贡献等级
我真的快死了 2024年10月13日
暂无贡献等级
TY0165  LV20 2024年6月24日
qiwwwww  LV2 2024年6月19日
wanderingsoul  LV2 2024年6月15日
qwm374149  LV1 2024年6月11日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友