From 39295f9780c6bc99a5646ba3c5e1615036c95c2d Mon Sep 17 00:00:00 2001 From: Bastian Kohler Date: Wed, 21 Jun 2023 09:49:45 +0200 Subject: [PATCH] Changed Format in Detection Report --- .../ueberwachungssystem/Detection/DetectionReport.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/example/ueberwachungssystem/Detection/DetectionReport.java b/app/src/main/java/com/example/ueberwachungssystem/Detection/DetectionReport.java index 96f9dbf..dc09371 100644 --- a/app/src/main/java/com/example/ueberwachungssystem/Detection/DetectionReport.java +++ b/app/src/main/java/com/example/ueberwachungssystem/Detection/DetectionReport.java @@ -1,8 +1,11 @@ package com.example.ueberwachungssystem.Detection; +import android.annotation.SuppressLint; import android.util.Log; +import java.text.SimpleDateFormat; import java.util.Calendar; +import java.util.Date; /** Detection Report Class */ public class DetectionReport { @@ -12,7 +15,11 @@ public class DetectionReport { public boolean detectionState; public DetectionReport(boolean detectionState, String detectionType, float detectedAmplitude) { - this.timeStamp = String.valueOf(Calendar.getInstance().getTime()); + // New Date Format + @SuppressLint("SimpleDateFormat") SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); + Date curDate = new Date(System.currentTimeMillis()); + this.timeStamp = formatter.format(curDate); + //Old Date Format: this.timeStamp = String.valueOf(Calendar.getInstance().getTime()); this.detectionType = detectionType; this.detectedValue = detectedAmplitude; this.detectionState = detectionState;