aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-11-08 13:37:38 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-11-08 13:37:38 +1300
commit9c9370f72c51d7466d3b25a59264ee98f4319b3a (patch)
tree1fca14e8a624e79f86b913dc60f94a93513a8eb0 /src/org/traccar/database
parent81d2b86ac7cca874b32c94fffa28b902c6fb0eca (diff)
downloadtrackermap-server-9c9370f72c51d7466d3b25a59264ee98f4319b3a.tar.gz
trackermap-server-9c9370f72c51d7466d3b25a59264ee98f4319b3a.tar.bz2
trackermap-server-9c9370f72c51d7466d3b25a59264ee98f4319b3a.zip
Fix time formatting issues
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/DataManager.java5
-rw-r--r--src/org/traccar/database/StatisticsManager.java3
2 files changed, 4 insertions, 4 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index 65f67ce44..8da6f2cca 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -20,7 +20,6 @@ import java.io.File;
import java.lang.reflect.Method;
import java.net.URL;
import java.sql.SQLException;
-import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
@@ -42,6 +41,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.traccar.Config;
import org.traccar.Context;
+import org.traccar.helper.DateUtil;
import org.traccar.model.Attribute;
import org.traccar.model.Device;
import org.traccar.model.Driver;
@@ -363,8 +363,7 @@ public class DataManager {
long historyDays = config.getInteger("database.historyDays");
if (historyDays != 0) {
Date timeLimit = new Date(System.currentTimeMillis() - historyDays * 24 * 3600 * 1000);
- LOGGER.info(
- "Clearing history earlier than " + new SimpleDateFormat(Context.DATE_FORMAT).format(timeLimit));
+ LOGGER.info("Clearing history earlier than " + DateUtil.formatDate(timeLimit, false));
QueryBuilder.create(dataSource, getQuery("database.deletePositions"))
.setDate("serverTime", timeLimit)
.executeUpdate();
diff --git a/src/org/traccar/database/StatisticsManager.java b/src/org/traccar/database/StatisticsManager.java
index 735c1f1a7..4e656bfd8 100644
--- a/src/org/traccar/database/StatisticsManager.java
+++ b/src/org/traccar/database/StatisticsManager.java
@@ -18,6 +18,7 @@ package org.traccar.database;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.traccar.Context;
+import org.traccar.helper.DateUtil;
import org.traccar.model.Statistics;
import javax.ws.rs.client.Entity;
@@ -71,7 +72,7 @@ public class StatisticsManager {
String url = Context.getConfig().getString("server.statistics");
if (url != null) {
- String time = Context.DATE_FORMATTER.format(statistics.getCaptureTime().toInstant());
+ String time = DateUtil.formatDate(statistics.getCaptureTime());
Form form = new Form();
form.param("version", Context.getAppVersion());