import java.util.*;
import static java.util.Calendar.YEAR;
import static java.util.Calendar.MONTH;
import static java.util.Calendar.DATE;
class TestCalendar
{
public static void main(String[] args)
{
Calendar calendar= Calendar.getInstance();
System.out.println(calendar);
Date date=calendar.getTime();
System.out.println(date);
System.out.println(calendar.get(YEAR));
System.out.println(calendar.get(MONTH));
System.out.println(calendar.get(DATE));
}
}
import java.util.*;
class TestTimeZone
{
public static void main(String[] args)
{
TimeZone tz= TimeZone.getDefault();
String timeZoneName=tz.getDisplayName();
System.out.println(timeZoneName);
System.out.println("获取该时区的ID:"+tz.getID());
String[] timeZoneids=tz.getAvailableIDs();
//System.out.println(Arrays.toString(timeZoneids));
//for(int i=0;i<timeZoneids.length;i++){
// System.out.println(timeZoneids[i]);
//}
Collection timeZoneidslist=Arrays.asList(timeZoneids);
for(Iterator timeZoneid=timeZoneidslist.iterator();timeZoneid.hasNext();){
System.out.println(String.valueOf(timeZoneid.next()));
}
}
}