From 9aa5f2793f38f01625c91b35d80c070da633d42a Mon Sep 17 00:00:00 2001 From: Chatura Dilan Perera Date: Tue, 30 Aug 2016 14:17:06 +0530 Subject: [PATCH] return date format as UTC in APIs --- .../carbon/device/mgt/jaxrs/common/GsonMessageBodyHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/common/GsonMessageBodyHandler.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/common/GsonMessageBodyHandler.java index 57e5c33e7e..f069edee75 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/common/GsonMessageBodyHandler.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/common/GsonMessageBodyHandler.java @@ -40,6 +40,7 @@ import static javax.ws.rs.core.MediaType.APPLICATION_JSON; @Consumes(APPLICATION_JSON) public class GsonMessageBodyHandler implements MessageBodyWriter, MessageBodyReader { + public static final String DATE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z"; private Gson gson; private static final String UTF_8 = "UTF-8"; @@ -50,7 +51,7 @@ public class GsonMessageBodyHandler implements MessageBodyWriter, Messag private Gson getGson() { if (gson == null) { final GsonBuilder gsonBuilder = new GsonBuilder(); - gson = gsonBuilder.setDateFormat("EEE, d MMM yyyy HH:mm:ss Z").create(); + gson = gsonBuilder.setDateFormat(DATE_FORMAT).create(); } return gson; }