我需要使用与
相同的时区创建一个日历对象实例(当前时间)java.util.GregorianCalendar[time=1383128400000,areFieldsSet=true,lenient=true,
zone=America/New_York,
firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2013,MONTH=9,WEEK_OF_YEAR=44,
WEEK_OF_MONTH=5,DAY_OF_MONTH=30,DAY_OF_YEAR=303,DAY_OF_WEEK=4,
DAY_OF_WEEK_IN_MONTH=5,AM_PM=0,HOUR=6,HOUR_OF_DAY=6,MINUTE=20,SECOND=0,
MILLISECOND=0,ZONE_OFFSET=-18000000,DST_OFFSET=3600000]
我该怎么做?
答案 0 :(得分:0)
Calendar c = Calendar.getInstance();
System.out.println(c.getTimeZone()+" milliseconds: "+c.getTimeInMillis());
c = Calendar.getInstance(TimeZone.getTimeZone("America/New_York"));
System.out.println(c.getTimeZone()+" milliseconds: "+c.getTimeInMillis());
注意:Java中的所有内容都是GMT格式。所以'现在'在我的时间是你的时间相同的毫秒。在那之后它是什么,无论你想用它做什么。