From 6424fe4a28599d55ccd67d68edd4420f9eff92eb Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Sun, 1 Apr 2018 14:21:49 +0300 Subject: [PATCH] Added timezone usage to FormatUtils #551 --- .../main/java/com/djrapitops/plan/utilities/FormatUtils.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/FormatUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/FormatUtils.java index 6551cfb26..df7aefc2d 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/FormatUtils.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/FormatUtils.java @@ -11,6 +11,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import java.util.Locale; +import java.util.TimeZone; /** * @author Rsl1122 @@ -70,9 +71,12 @@ public class FormatUtils { } private static String format(long epochMs, String format) { + boolean useServerTime = Settings.USE_SERVER_TIME.isTrue(); String locale = Settings.LOCALE.toString(); Locale usedLocale = locale.equalsIgnoreCase("default") ? Locale.ENGLISH : Locale.forLanguageTag(locale); SimpleDateFormat dateFormat = new SimpleDateFormat(format, usedLocale); + TimeZone timeZone = useServerTime ? TimeZone.getDefault() : TimeZone.getTimeZone("GMT"); + dateFormat.setTimeZone(timeZone); return dateFormat.format(epochMs); }