-2
我的系统时区为Asia/Calcutta
。我需求量的是时间在一个时区转换成其他。
long l = 1223123123232l;// long value representing the date.
TimeZone tz = TimeZone.getTimeZone("Australia/Sydney");// First Time zone
long tzOff = tz.getOffset(l);
java.util.Date d = new Date(l-tzOff); // WHY THIS??
DateFormat df = new SimpleDateFormat("dd MMM yyyy HH:mm:ss z");
df.setTimeZone(TimeZone.getTimeZone("Africa/Asmara"));// Required Time zone
String s = df.format(d);
System.out.println(s);
我的代码有什么问题?
你不是最近发布的同一个问题
试试? – NPE
是的,先生,但我现在面临这个问题,需要紧急解决这个问题? –