Java SimpleTimeZone setEndRule()方法与示例

SimpleTimeZone类setEndRule()方法 (SimpleTimeZone Class setEndRule() method)

Syntax:

句法:

    public void setEndRule(int en_mm, int en_dd, int en_time);
public void setEndRule(int en_mm, int en_dd, int en_dow, int en_time);
public void setEndRule(int en_mm, int en_dd,int en_dow, int en_time, boolean status);

  • setEndRule() method is available in java.util package.

    setEndRule()方法在java.util包中可用。

  • setEndRule(int en_mm, int en_dd, int en_time) method is used to set the ending rule of DST(Daylight Savings Time) to the given fixed date (dd) in a month.

    setEndRule(int en_mm,int en_dd,int en_time)方法用于将DST(夏令时)的结束规则设置为一个月中的给定固定日期(dd)。

  • setEndRule(int en_mm, int en_dd,int en_dow, int en_time) method is used to set the end rule of DST(Daylight Savings Time).

    setEndRule(int en_mm,int en_dd,int en_dow,int en_time)方法用于设置DST(夏令时)的结束规则。

  • setEndRule(int en_mm, int en_dd, int en_dow, int en_time, boolean status) method is used to set the ending rule of DST(Daylight Savings Time) to the earlier weekday (dow) or after the given date (dd) in a month.

    setEndRule(int en_mm,int en_dd,int en_dow,int en_time,布尔状态)方法用于将DST(夏令时)的结束规则设置为较早的工作日(dow)或一个月中给定日期(dd)之后。

  • These methods may throw an exception at the time of setting end rule.

    这些方法在设置结束规则时可能会引发异常。

    IllegalArgumentException: This exception may throw when any one of the parameters is not in a range.

    IllegalArgumentException :当任何一个参数不在范围内时,可能引发此异常。

  • These are non-static methods and it is accessible with the class object only and if we try to access these methods with the class name then we will get an error.

    这些是非静态方法,只能通过类对象访问,如果尝试使用类名称访问这些方法,则会收到错误消息。

Parameter(s):

参数:

  • In the first case, setEndRule(int en_mm, int en_dd,int en_time)

    在第一种情况下, setEndRule(int en_mm,int en_dd,int en_time)

    • int en_mm – represents the DST ending month.
    • int en_mm –表示夏令时结束的月份。
    • int en_dd – represents the DST ending day of month.
    • int en_dd –表示夏令时结束的月份。
    • int en_time – represents the DST ending time.
    • int en_time –表示DST的结束时间。
  • In the second case, setEndRule(int en_mm, int en_dd,int en_dow,int en_time),

    在第二种情况下, setEndRule(int en_mm,int en_dd,int en_dow,int en_time)

    • int en_mm – represents the DST ending month.
    • int en_mm –表示夏令时结束的月份。
    • int en_dd – represents the DST ending day of month.
    • int en_dd –表示夏令时结束的月份。
    • int en_dow – represents DST last day of week.
    • int en_dow –表示夏令时。
    • int en_time – represents the DST ending time.
    • int en_time –表示DST的结束时间。
  • In the second case, setEndRule(int en_mm, int en_dd,int en_dow,int en_time,boolean status),

    在第二种情况下, setEndRule(int en_mm,int en_dd,int en_dow,int en_time,布尔值状态)

    • int en_mm – represents the DST ending month.
    • int en_mm –表示夏令时结束的月份。
    • int en_dd – represents the DST ending day of month.
    • int en_dd –表示夏令时结束的月份。
    • int en_dow – represents DST last day of week.
    • int en_dow –表示夏令时。
    • int en_time – represents the DST ending time.
    • int en_time –表示DST的结束时间。
    • boolean status – sets to true then this rule selects first en_dow on or after en_dd otherwise this rule selects last en_dow on or before en_dd.
    • 布尔状态 –设置为true,然后此规则选择在en_dd或之后的第一个en_dow,否则该规则选择在en_dd或之前的最后一个en_dow。

Return value:

返回值:

In all cases, the return type of the method is void – It returns nothing.

在所有情况下,该方法的返回类型均为空 –它不返回任何内容。

Example:

例:

// Java program to demonstrate the example 
// of setEndRule() method of SimpleTimeZone
import java.util.*;
public class SetEndRuleOfSimpleTimeZone {
public static void main(String args[]) {
// Instantiates SimpleTimeZone object
SimpleTimeZone s_tz1 = new SimpleTimeZone(360, "FRANCE");
SimpleTimeZone s_tz2 = new SimpleTimeZone(760, "JAPAN");
SimpleTimeZone s_tz3 = new SimpleTimeZone(39800000, "US",
Calendar.APRIL, 6, -Calendar.MONDAY, 7200000, Calendar.OCTOBER, -1,
Calendar.MONDAY, 7200000, 3600000);
// By using setEndRule() method is used to
// set the DST end rule to a constant date
s_tz1.setEndRule(Calendar.JUNE, Calendar.MONDAY, 3800000);
// By using setEndRule() method is used to
// set the DST end rule to a weekday before
// or after the given date
s_tz2.setEndRule(Calendar.JUNE, Calendar.MONDAY, 2, 3800000, false);
// By using setEndRule() method is used to
// set the DST end rule 
s_tz3.setEndRule(Calendar.JUNE, Calendar.MONDAY, 2, 3800000);
// Display SimpleTimeZone
System.out.print("s_tz1.setEndRule(Calendar.JUNE, Calendar.MONDAY,3800000): ");
System.out.println(s_tz1);
System.out.print("s_tz2.setEndRule(Calendar.JUNE, Calendar.MONDAY,3800000,false): ");
System.out.println(s_tz1);
System.out.print("s_tz3.setEndRule(Calendar.JUNE, Calendar.MONDAY,2,3800000): ");
System.out.println(s_tz1);
}
}

Output

输出量

s_tz1.setEndRule(Calendar.JUNE, Calendar.MONDAY,3800000): java.util.SimpleTimeZone[id=FRANCE,offset=360,dstSavings=3600000,useDaylight=false,startYear=0,startMode=0,startMonth=0,startDay=0,startDayOfWeek=0,startTime=0,startTimeMode=0,endMode=1,endMonth=5,endDay=2,endDayOfWeek=0,endTime=3800000,endTimeMode=0]
s_tz2.setEndRule(Calendar.JUNE, Calendar.MONDAY,3800000,false): java.util.SimpleTimeZone[id=FRANCE,offset=360,dstSavings=3600000,useDaylight=false,startYear=0,startMode=0,startMonth=0,startDay=0,startDayOfWeek=0,startTime=0,startTimeMode=0,endMode=1,endMonth=5,endDay=2,endDayOfWeek=0,endTime=3800000,endTimeMode=0]
s_tz3.setEndRule(Calendar.JUNE, Calendar.MONDAY,2,3800000): java.util.SimpleTimeZone[id=FRANCE,offset=360,dstSavings=3600000,useDaylight=false,startYear=0,startMode=0,startMonth=0,startDay=0,startDayOfWeek=0,startTime=0,startTimeMode=0,endMode=1,endMonth=5,endDay=2,endDayOfWeek=0,endTime=3800000,endTimeMode=0]

翻译自: https://www.includehelp.com/java/simpletimezone-setendrule-method-with-example.aspx

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/379485.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Linux设备驱动开发--- DMA

文章目录1 设置DMA映射缓存一致性和DMADMA映射一致映射流式DMA映射2 完成的概念3 DMA引擎API分配DMA从通道设置从设备和控制器指定参数获取事务描述符提交事务发布待处理DMA请求并等待回调通知4 程序单缓冲区映射分散聚集映射DMA是计算机系统的一项功能,它允许设备在…

类加载器

一、类加载器 1,什么是类加载器? 类加载器就是用来加载字节码文件 2,类加载器的种类有哪些? 1)BootStrap:引导类加载器:加载都是最基础的文件 2)ExtClassLoader:扩展类加…

一个用java读取XML文件的简单方法(转)

XML文件 book.xml <book> <person> <first>Kiran</first> <last>Pai</last> <age>22</age> </person> <person> <first>Bill</first> <last>Gates</last> <age>46</age&g…

Java ObjectStreamField getName()方法与示例

ObjectStreamField类的getName()方法 (ObjectStreamField Class getName() method) getName() method is available in java.io package. getName()方法在java.io包中可用。 getName() method is used to get the name of this ObjectStreamField field. getName()方法用于获取…

【css】CSS中折叠margin的问题

为什么要翻译这篇说明&#xff1f;css2本有人已翻译过&#xff0c;但看一下&#xff0c;很粗糙&#xff08;不是说自己就怎么怎么样啊&#xff0c;翻译者真的是很值得敬佩的&#xff01;&#xff09;&#xff0c;近来跟css与xhtml接触得越来越多&#xff0c;但接触得越多&#…

算法---链表

文章目录反转链表合并两个有序链表删除重复元素反转链表 反转链表包括两种&#xff0c;反转全部元素或者反转部分元素。在这里&#xff0c;我们约定&#xff1a;数据元素类型是struct LinkNode&#xff0c;要反转链表的第一个节点是head&#xff0c;head的前面一个节点是pre&a…

SSM

二、环境设置&#xff08;MyEclipse&#xff09; 1&#xff0c;字体设置 window–>Preference->General->Appearance->Colors and Fonts->Basic Text->Font 2&#xff0c;workspace字符集设置 window–>Preference->General->Appearance->W…

IOS NSArray,NSDictionary

小结&#xff1a; NSArray有序的集合&#xff1b; NSDictionary无序的集合&#xff0c;可排序&#xff1b; 增删改查 ------NSArray----------- create : 1)NSArray *array [NSArray arrayWithObjects:"Henry","Jones", "Susan", "Smith&q…

Java PropertyPermission equals()方法与示例

PropertyPermission类equals()方法 (PropertyPermission Class equals() method) equals() method is available in java.util package. equals()方法在java.util包中可用。 equals() method is used to check whether this object and the given object (ob) are equal or not…

c#配合oracle快速导入excel方法--原创(6万条记录5分钟左右)

原理&#xff1a;用c#采用读取Excel数据源方式将数据读入c#的datatable,循环datatable,将datatable中的数据用stringbuilder拼成insert into (字段名) valus (值);每5条插入一个符号&#xff08;作用是将sql字符串限制在4000字符以内&#xff09;&#xff0c;然后将拼成的字符串…

English最俗语法大全

一、先分析两个长难句 1,It is a truth universally acknowledged that a single man in possession of a good fortune must be in want of a wife. 人们公认这样一个事实&#xff0c;一个有钱的单身男人一定想要娶一个妻子。 in want of want 想要 university widely 广泛的…

tfs 内网和外网切换的方法。

C:\Windows\System32\drivers\etc的hosts文件配置一个123.67.128.109 geo-dept-3转载于:https://www.cnblogs.com/lwflt/archive/2012/07/23/2604731.html

observable_Java Observable countObservers()方法与示例

observable可观察的类countObservers()方法 (Observable Class countObservers() method) countObservers() method is available in java.util package. countObservers()方法在java.util包中可用。 countObservers() method is used to count the number of observers exists…

设计模式--Strategy 策略模式

所谓策略模式(Strategy Pattern)&#xff0c;就是将策略 (算法) 封装为一个对象&#xff0c;易于相互替换&#xff0c;如同 USB 设备一样可即插即用&#xff1b;如果将策略、具体的算法和行为&#xff0c;编码在某个类或客户程序内部&#xff0c;将导至事后的修改和扩展不易。 …

HDU-1518 Square dfs+剪枝

该题问给定的棍子能否组成一个正方形。首先我们要判定是否总长度是4的倍数&#xff0c;然后再决定是否存在某条边大于组合边长。 搜索的过程中也是可以进行剪枝了。 首先将边排序&#xff0c;我们可以假定所有的组合边由大小递减的边组成&#xff0c;那么我们在搜索的时候就不用…

英语思维黄金法则

一、谓语单一原则 英文的句子当中&#xff0c;有且只有一套谓语结构。 要想使用多个谓语&#xff0c;有以下三种方法&#xff1a; 1&#xff0c;利用连词将不同谓语并列起来 2&#xff0c;把其中的一些动词给降级&#xff08;v-ing v-ed 非谓语动词&#xff09; 3&#xff0c;…

java getname_Java文件类字符串getName()方法(带示例)

java getname文件类字符串getName() (File Class String getName()) This method is available in package java.io.File.getName(). 软件包java.io.File.getName()中提供了此方法。 This method is used to retrieve or return the filename or directory name and represente…

WF中DependencyObject和DependencyProperty的实现

WF中DependencyObject和DependencyProperty的实现 DependencyProperty的Register和RegisterAttached方法&#xff0c;将DependencyProperty存在IDictionary中完成注册&#xff0c;确保相同name的DependencyProperty在一个ownerType类型中只能有一个。 DependencyObject的GetVal…

hdu2115: I Love This Game

hdu2115: http://acm.hdu.edu.cn/showproblem.php?pid2115题意&#xff1a;输入n组名字和对应的时间&#xff08;分&#xff1a;秒&#xff09;&#xff0c;要求按时间长度由短到长排序&#xff0c;并输出对应排名&#xff0c;若时间一样&#xff0c;则按名字字典序排序&#…

打开eclipse出现Failed to load the JNI shared library “D:\java\jdk\bin\...\jre\bin\server\jvm.dll”如何解决?

eclipse打开的时候出现Failed to load the JNI shared library “D:\java\jdk\bin…\jre\bin\server\jvm.dll”如何解决&#xff1f;&#xff1f; 如图所示&#xff1a; 即代表你的jdk与eclipse的位数不一样&#xff01;&#xff01;&#xff01; 你可以查看一下eclipse和jd…