我想通过时区和偏移量获取格式化的日期和时间。最近我用这个代码进行格式化。如何使用java中的偏移量获取带日期时间和时区的格式化日期
public static String getFormattedLicenseDate(long date) {
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG);
return dateFormat.format(new Date(date));
}
如果输入为1476786856310的此方法返回“16年10月18日下午4时04分16秒HST”,但我想修改这种方法来获得“2016年10月18日16时04分04秒HST (HST-10:00)”
有什么模式来得到这个输出,如 “二零一六年十月十八日16时04分04秒HST(HST-10:00)”
搜索发布前堆栈溢出。这已经被处理了很多次了。 –