全屏
setEndRule(int endMonth, int endDay, int endDayOfWeek, int endTime) 方法是用来设置夏令时结束规则。
声明
以下是java.util.SimpleTimeZone.setEndRule()方法的声明。public void setEndRule(int endMonth,
int endDay,
int endDayOfWeek,
int endTime)
参数endMonth-- 保存时间结束的月份白昼。
endDay-- 在其上夏令时结束的当天。
endTime--在夏令时结束时间以本地挂钟时间。
endDayOfWeek--夏令时结束一天的一周。
返回值
NA
异常IllegalArgumentException--这将被抛出,如果指定的endMonth,endday,endDayOfWeek或endTime以参数超出范围。
例子
下面的例子显示java.util.SimpleTimeZone.setEndRule()方法的使用package cn.sxt;
import java.util.*;
public class SimpleTimeZoneDemo {
public static void main( String args[] ){
// create simple time zone object
SimpleTimeZone stobj = new SimpleTimeZone(-28800000,
"America/Los_Angeles", Calendar.AUGUST, 1,-Calendar.SUNDAY, 7200000,
Calendar.DECEMBER, -1, Calendar.SUNDAY, 7200000, 3600000);
// checking the initial value
System.out.println("Initial value : " + stobj);
// setting end rule
stobj.setEndRule( Calendar.MAY, 2, Calendar.TUESDAY, 3600000);
// checking the new value
System.out.println("New value : " + stobj);
}
}
现在编译和运行上面的代码示例,将产生以下结果。Initial value : java.util.SimpleTimeZone[id=GMT,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]
New value : java.util.SimpleTimeZone[id=GMT,offset=820,dstSavings=3600000,
useDaylight=false,startYear=0,startMode=0,startMonth=0,startDay=0,
startDayOfWeek=0,startTime=0,startTimeMode=0,endMode=2,endMonth=4,
endDay=2,endDayOfWeek=3,endTime=3600000,endTimeMode=0]
分享到:
0评论