java.util.SimpleTimeZone.setStartYear() java.util.SimpleTimeZone.setStartRule() java.util.SimpleTimeZone.toString() 描述 该setStartYear(int year))方法用于设置夏令时的开始年份。 声明 以下是java.util.SimpleTimeZone.setStartYear()方法的声明。 public void setStartYear(int year) 参数 year - 夏令时开始的一年。 返回值 NA 异常 NA 实例 以下示例显示了java.util.SimpleTimeZone.setStartYear()的用法 package com.tutorialspoint; import java.util.*; public class SimpleTimeZoneDemo { public static void main( String args[] ) { // create simple time zone object SimpleTimeZone stobj = new SimpleTimeZone(820,"US"); // checking initial value System.out.println("Initial value: " + stobj); // setting start year stobj.setStartYear(2008); // checking the new value System.out.println("Final value : " + stobj); } } 让我们编译并运行上面的程序,这将产生以下结果。 Initial value: java.util.SimpleTimeZone[id = US,offset = 820,dstSavings = 3600000, useDaylight = false,startYear = 0,startMode = 0,startMonth = 0,startDay = 0, startDayOfWeek = 0,startTime = 0,startTimeMode = 0,endMode = 0,endMonth = 0, endDay = 0,endDayOfWeek = 0,endTime = 0,endTimeMode = 0] Final value : java.util.SimpleTimeZone[id = US,offset = 820,dstSavings = 3600000, useDaylight = false,startYear = 2008,startMode = 0,startMonth = 0,startDay = 0, startDayOfWeek = 0,startTime = 0,startTimeMode = 0,endMode = 0,endMonth = 0, endDay = 0,endDayOfWeek = 0,endTime = 0,endTimeMode = 0] java.util.SimpleTimeZone.setStartRule() java.util.SimpleTimeZone.toString()