Fixed issue with 12 hour times - now uses 24 hour times.

This commit is contained in:
Graham Jones
2022-01-04 20:41:54 +00:00
parent fbb3563f3a
commit 0715ce4f44
2 changed files with 7 additions and 7 deletions

View File

@@ -195,7 +195,7 @@ public class LogManager implements AuthCallbackInterface, EventCallbackInterface
public void writeToLocalDb(SdData sdData) { public void writeToLocalDb(SdData sdData) {
Log.v(TAG, "writeToLocalDb()"); Log.v(TAG, "writeToLocalDb()");
Date curDate = new Date(); 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 dateStr = dateFormat.format(curDate);
String SQLStr = "SQLStr"; String SQLStr = "SQLStr";
@@ -419,7 +419,7 @@ public class LogManager implements AuthCallbackInterface, EventCallbackInterface
return; return;
} }
try { 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) { } catch (ParseException e) {
Log.e(TAG, "Error parsing date " + eventDateStr); Log.e(TAG, "Error parsing date " + eventDateStr);
return; return;
@@ -460,7 +460,7 @@ public class LogManager implements AuthCallbackInterface, EventCallbackInterface
finishUpload(); finishUpload();
return; return;
} }
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss"); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
try { try {
eventDate = dateFormat.parse(eventDateStr); eventDate = dateFormat.parse(eventDateStr);
} catch (ParseException e) { } catch (ParseException e) {
@@ -473,7 +473,7 @@ public class LogManager implements AuthCallbackInterface, EventCallbackInterface
long eventDateMillis = eventDate.getTime(); long eventDateMillis = eventDate.getTime();
long startDateMillis = eventDateMillis - 1000*60* eventDuration/2; long startDateMillis = eventDateMillis - 1000*60* eventDuration/2;
long endDateMillis = 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( String datapointsJsonStr = getDatapointsbyDate(
dateFormat.format(new Date(startDateMillis)), dateFormat.format(new Date(startDateMillis)),
@@ -483,7 +483,7 @@ public class LogManager implements AuthCallbackInterface, EventCallbackInterface
JSONArray dataObj; JSONArray dataObj;
mDatapointsToUploadList = new ArrayList<JSONObject>(); mDatapointsToUploadList = new ArrayList<JSONObject>();
try { 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); dataObj = new JSONArray(datapointsJsonStr);
for (int i = 0 ; i < dataObj.length(); i++) { for (int i = 0 ; i < dataObj.length(); i++) {
mDatapointsToUploadList.add(dataObj.getJSONObject(i)); mDatapointsToUploadList.add(dataObj.getJSONObject(i));

View File

@@ -151,7 +151,7 @@ public class WebApiConnection {
Log.v(TAG, "not logged in - doing nothing"); Log.v(TAG, "not logged in - doing nothing");
return (false); 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(); JSONObject jsonObject = new JSONObject();
try { try {
jsonObject.put("eventType", String.valueOf(eventType)); jsonObject.put("eventType", String.valueOf(eventType));
@@ -229,7 +229,7 @@ public class WebApiConnection {
return (false); 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(); JSONObject jsonObject = new JSONObject();
try { try {
//jsonObject.put("userId", -1); //jsonObject.put("userId", -1);