Update LocaleUtils.java
This commit is contained in:
parent
daab6c5597
commit
6ecfaeef74
|
@ -85,7 +85,11 @@ public class LocaleUtils {
|
||||||
public static DateTimeFormatter getDateTimeFormatter(Context context) {
|
public static DateTimeFormatter getDateTimeFormatter(Context context) {
|
||||||
if (dateTimeFormatter == null) {
|
if (dateTimeFormatter == null) {
|
||||||
@SuppressLint("DiscouragedApi") int resId = context.getResources().getIdentifier("world_time", "string", context.getPackageName());
|
@SuppressLint("DiscouragedApi") int resId = context.getResources().getIdentifier("world_time", "string", context.getPackageName());
|
||||||
dateTimeFormatter = DateTimeFormatter.ofPattern(context.getString(resId)).withZone(ZoneId.systemDefault());
|
String time = "EEE, MMM d, yyyy HH:mm:ss";
|
||||||
|
if (resId != 0) {
|
||||||
|
time = context.getString(resId);
|
||||||
|
}
|
||||||
|
dateTimeFormatter = DateTimeFormatter.ofPattern(time).withZone(ZoneId.systemDefault());
|
||||||
}
|
}
|
||||||
return dateTimeFormatter;
|
return dateTimeFormatter;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue