我現在在香港。我如何從美國得到年,月和日?
我曾嘗試:如何從不同的時區獲得年,月和日?
Calendar calendar = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy hh:mm:ss z");
sdf.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));
sdf.format(calendar.getTime());
但我不知道怎麼弄的年,月。 請幫助
對不起日期回覆17,但應該是16 – jjLin
編輯,一年應該從LATime – jjLin
得到對!感謝修正。 – DNax