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

com.zcj.util.json.gson.serializer.GsonDateSerializer Maven / Gradle / Ivy

package com.zcj.util.json.gson.serializer;

import com.google.gson.JsonElement;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.zcj.util.UtilDate;

import java.lang.reflect.Type;
import java.util.Date;

public class GsonDateSerializer implements JsonSerializer {

    @Override
    public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) {
        return context.serialize(UtilDate.format(src, "yyyy-MM-dd"));
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy