From 0715ce4f44c1a05ccdaae2d5d66269418be28171 Mon Sep 17 00:00:00 2001 From: Graham Jones Date: Tue, 4 Jan 2022 20:41:54 +0000 Subject: [PATCH] Fixed issue with 12 hour times - now uses 24 hour times. --- .../java/uk/org/openseizuredetector/LogManager.java | 10 +++++----- .../uk/org/openseizuredetector/WebApiConnection.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/uk/org/openseizuredetector/LogManager.java b/app/src/main/java/uk/org/openseizuredetector/LogManager.java index d428aac..cd141e5 100644 --- a/app/src/main/java/uk/org/openseizuredetector/LogManager.java +++ b/app/src/main/java/uk/org/openseizuredetector/LogManager.java @@ -195,7 +195,7 @@ public class LogManager implements AuthCallbackInterface, EventCallbackInterface public void writeToLocalDb(SdData sdData) { Log.v(TAG, "writeToLocalDb()"); Date curDate = new Date(); - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String dateStr = dateFormat.format(curDate); String SQLStr = "SQLStr"; @@ -419,7 +419,7 @@ public class LogManager implements AuthCallbackInterface, EventCallbackInterface return; } try { - eventDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(eventDateStr); + eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(eventDateStr); } catch (ParseException e) { Log.e(TAG, "Error parsing date " + eventDateStr); return; @@ -460,7 +460,7 @@ public class LogManager implements AuthCallbackInterface, EventCallbackInterface finishUpload(); return; } - DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss"); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); try { eventDate = dateFormat.parse(eventDateStr); } catch (ParseException e) { @@ -473,7 +473,7 @@ public class LogManager implements AuthCallbackInterface, EventCallbackInterface long eventDateMillis = eventDate.getTime(); long startDateMillis = eventDateMillis - 1000*60* eventDuration/2; long endDateMillis = eventDateMillis + 1000*60*eventDuration/2; - dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String datapointsJsonStr = getDatapointsbyDate( dateFormat.format(new Date(startDateMillis)), @@ -483,7 +483,7 @@ public class LogManager implements AuthCallbackInterface, EventCallbackInterface JSONArray dataObj; mDatapointsToUploadList = new ArrayList(); try { - //DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss"); + //DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); dataObj = new JSONArray(datapointsJsonStr); for (int i = 0 ; i < dataObj.length(); i++) { mDatapointsToUploadList.add(dataObj.getJSONObject(i)); diff --git a/app/src/main/java/uk/org/openseizuredetector/WebApiConnection.java b/app/src/main/java/uk/org/openseizuredetector/WebApiConnection.java index 9280062..005cbd0 100644 --- a/app/src/main/java/uk/org/openseizuredetector/WebApiConnection.java +++ b/app/src/main/java/uk/org/openseizuredetector/WebApiConnection.java @@ -151,7 +151,7 @@ public class WebApiConnection { Log.v(TAG, "not logged in - doing nothing"); return (false); } - DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss"); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); JSONObject jsonObject = new JSONObject(); try { jsonObject.put("eventType", String.valueOf(eventType)); @@ -229,7 +229,7 @@ public class WebApiConnection { return (false); } - DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss"); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); JSONObject jsonObject = new JSONObject(); try { //jsonObject.put("userId", -1);