我怎样才能得到当前的时间在德国无论用户和当前设备的时间位置?
日历buttoncal = Calendar.getInstance();
串tdate =新的SimpleDateFormat(dd.MM,Locale.GERMANY).format(buttoncal.getTime());
串tday =新的SimpleDateFormat(EEEE,Locale.GERMANY).format(buttoncal.getTime());
one_date.setText(tdate.toString());
one_day.setText(tday);
解决方案
使用的 android.text.format.Time ,而不是作为我建议在这里。
How can I get the current time in Germany regardless of the location of the user and current device time?
Calendar buttoncal = Calendar.getInstance();
String tdate = new SimpleDateFormat("dd.MM",Locale.GERMANY).format(buttoncal.getTime());
String tday = new SimpleDateFormat("EEEE",Locale.GERMANY).format(buttoncal.getTime());
one_date.setText(tdate.toString());
one_day.setText(tday);
解决方案
Use android.text.format.Time instead as I suggested over here.