diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/Constants.java b/src/main/java/ch/ethz/seb/sebserver/gbl/Constants.java index 5320c4b2..f13b0f9e 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/Constants.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/Constants.java @@ -90,6 +90,9 @@ public final class Constants { public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; public static final String DEFAULT_TIME_FORMAT = "HH:mm:ss"; + public static final DateTimeFormatter STANDARD_DATE_TIME_MILLIS_FORMATTER = DateTimeFormat + .forPattern(DEFAULT_DATE_TIME_MILLIS_FORMAT) + .withZoneUTC(); public static final DateTimeFormatter STANDARD_DATE_TIME_FORMATTER = DateTimeFormat .forPattern(DEFAULT_DATE_TIME_FORMAT) .withZoneUTC(); diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/util/Utils.java b/src/main/java/ch/ethz/seb/sebserver/gbl/util/Utils.java index 0061aeaf..2cbe734c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/util/Utils.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/util/Utils.java @@ -244,7 +244,7 @@ public final class Utils { } public static String formatDate(final DateTime dateTime) { - return dateTime.toString(Constants.DEFAULT_DATE_TIME_MILLIS_FORMAT); + return dateTime.toString(Constants.STANDARD_DATE_TIME_MILLIS_FORMATTER); } public static Long dateTimeStringToTimestamp(final String startTime, final Long defaultValue) { diff --git a/src/test/java/ch/ethz/seb/sebserver/webservice/servicelayer/exam/impl/SEBClientEventCSVExporterTest.java b/src/test/java/ch/ethz/seb/sebserver/webservice/servicelayer/exam/impl/SEBClientEventCSVExporterTest.java index 2797d490..cfa8275b 100644 --- a/src/test/java/ch/ethz/seb/sebserver/webservice/servicelayer/exam/impl/SEBClientEventCSVExporterTest.java +++ b/src/test/java/ch/ethz/seb/sebserver/webservice/servicelayer/exam/impl/SEBClientEventCSVExporterTest.java @@ -120,7 +120,7 @@ public class SEBClientEventCSVExporterTest { final String string = Utils.toString(array); Assert.assertEquals( - "INFO_LOG,\"text\",5,1970-01-01T00:00:00.003,1970-01-01T00:00:00.004,\"name\",\"description\",BYOD,1970-01-01T01:00:00.001,1970-01-01T01:00:00.001\n", + "INFO_LOG,\"text\",5,1970-01-01T00:00:00.003,1970-01-01T00:00:00.004,\"name\",\"description\",BYOD,1970-01-01T00:00:00.001,1970-01-01T00:00:00.001\n", string); } @@ -142,7 +142,7 @@ public class SEBClientEventCSVExporterTest { final String string = Utils.toString(array); Assert.assertEquals( - "INFO_LOG,\"text\",5,1970-01-01T00:00:00.003,1970-01-01T00:00:00.004,\"sessionid\",\"clientaddress\",status,token,\"name\",\"description\",BYOD,1970-01-01T01:00:00.001,1970-01-01T01:00:00.001\n", + "INFO_LOG,\"text\",5,1970-01-01T00:00:00.003,1970-01-01T00:00:00.004,\"sessionid\",\"clientaddress\",status,token,\"name\",\"description\",BYOD,1970-01-01T00:00:00.001,1970-01-01T00:00:00.001\n", string); } }