From: David ‘Bombe’ Roden Date: Thu, 21 Oct 2010 12:12:19 +0000 (+0200) Subject: Return date of last update in JSON object. X-Git-Tag: 0.1-RC1~119 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=ac9fbc286812077feb8a5207448a011727843b80;p=Sone.git Return date of last update in JSON object. --- diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/GetSoneStatusPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/GetSoneStatusPage.java index 7a4bfda..e5385fa 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetSoneStatusPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetSoneStatusPage.java @@ -17,6 +17,9 @@ package net.pterodactylus.sone.web.ajax; +import java.text.SimpleDateFormat; +import java.util.Date; + import net.pterodactylus.sone.core.Core; import net.pterodactylus.sone.core.Core.SoneStatus; import net.pterodactylus.sone.data.Sone; @@ -52,7 +55,7 @@ public class GetSoneStatusPage extends JsonPage { String soneId = request.getHttpRequest().getParam("sone"); Sone sone = core.getSone(soneId); SoneStatus soneStatus = core.getSoneStatus(sone); - return new JsonObject().put("status", soneStatus.name()).put("modified", sone.getModificationCounter() > 0); + return new JsonObject().put("status", soneStatus.name()).put("modified", sone.getModificationCounter() > 0).put("lastUpdated", new SimpleDateFormat("MMM d, yyyy, HH:mm:ss").format(new Date(sone.getTime()))); } }