mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-27 19:47:49 +01:00
Added timezone usage to FormatUtils #551
This commit is contained in:
parent
024a0ab62e
commit
6424fe4a28
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user