java end 方法_setEndRule(int endMonth, int endDay, int endDayOfWeek, int endTime)方法实例

全屏

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评论

14487a65ea137d8f9ac97cdce44a0324.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值