Java tutorial
/** * (c) 2003-2015 MuleSoft, Inc. The software in this package is * published under the terms of the CPAL v1.0 license, a copy of which * has been included with this distribution in the LICENSE.md file. */ package org.mule.modules.zendesk.jersey; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import org.joda.time.format.ISODateTimeFormat; import java.lang.reflect.Type; import java.util.Date; /** * @author Mulesoft, Inc */ public class DateDeserializer implements JsonDeserializer<Date> { public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return ISODateTimeFormat.dateTimeNoMillis().parseDateTime(json.getAsJsonPrimitive().getAsString()).toDate(); } }