From 2dd2aa777540ad08937943dec16925969f93c51a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 27 May 2019 08:08:14 -0700 Subject: Fix time decoding --- src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main/java/org/traccar') diff --git a/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java index c11c97df3..534937235 100644 --- a/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java @@ -26,9 +26,11 @@ import org.traccar.model.Position; import org.traccar.model.WifiAccessPoint; import java.net.SocketAddress; +import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.TimeZone; public class MictrackProtocolDecoder extends BaseProtocolDecoder { @@ -37,7 +39,9 @@ public class MictrackProtocolDecoder extends BaseProtocolDecoder { } private Date decodeTime(String data) throws ParseException { - return new SimpleDateFormat("yyMMddHHmmss").parse(data); + DateFormat dateFormat = new SimpleDateFormat("yyMMddHHmmss"); + dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + return dateFormat.parse(data); } private void decodeLocation(Position position, String data) throws ParseException { -- cgit v1.2.3