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

Java SimpleTimeZone setEndRule()方法与示例相关推荐

  1. Java IOUtils.copy方法代码示例(亲测)

    本文整理汇总了Java中org.apache.commons.io.IOUtils.copy方法的典型用法代码示例.如果您正苦于以下问题:Java IOUtils.copy方法的具体用法?Java I ...

  2. java user directory,Java ProcessBuilder directory()方法与示例

    语法:public File directory (); public ProcessBuilder directory (File dir); ProcessBuilder类directory()方 ...

  3. Java序列化魔术方法及其示例使用

    在上一篇文章中, 您需要了解有关Java序列化的所有知识 ,我们讨论了如何通过实现Java序列化来启用类的可序列化性. Serializable接口. 如果我们的类未实现Serializable接口, ...

  4. catalog java,Java Connection getCatalog()方法与示例

    通常,目录是一个目录,其中包含有关数据集,文件或数据库的信息.而数据库目录中包含所有数据库,基本表,视图(虚拟表),同义词,值范围,索引,用户和用户组的列表. Connection接口的getCata ...

  5. filepermission java,Java FilePermission getActions()方法与示例

    FilePermission类getActions()方法getActions()方法在java.io包中可用. getActions()方法用于检查此FilePermission和给定对象在路径名和 ...

  6. java方法参数Bundle,Java ResourceBundle keySet()方法及示例

    ResourceBundle类keySet()方法keySet()方法在java.util包中可用. keySet()方法用于从此ResourceBundle及其超级捆绑包中获取所有现有键,以在Set ...

  7. java exec waitfor,Java Process waitFor()方法与示例

    流程类waitFor()方法在java.lang包中提供了waitFor()方法. waitFor()方法用于使当前正在运行的线程在需要时等待,直到由该Process对象表示的进程完成其终止为止. 当 ...

  8. java arraylist.add(),Java ArrayList add()方法与示例

    ArrayList类add()方法 语法:public boolean add(T ele); public void add(int indices, T ele);add()方法在java.uti ...

  9. java rollback用法,Java Connection rollBack()方法与示例

    回滚操作将撤消当前事务所做的所有更改,即,如果调用Connection接口的rollBack()方法,则所有修改都将还原到最后一次提交. 您还可以通过将所需的Savepoint对象作为参数传递给此方法 ...

最新文章

  1. 怎么合成音乐_剪映教程:剪映怎么剪辑音乐?
  2. findContours函数
  3. JAVA:Java二维数组处理-Bit型转Bitmap
  4. 特殊类型结构--枚举
  5. flutter json转对象_在 Flutter 使用 Redux 来共享状态和管理单一数据
  6. Halcon Blob分析(二值化图像分割)
  7. NYOJ题目1057-寻找最大数(三)
  8. paip.js input onclick失灵不起作用无反应的解决.txt
  9. 计算机无法用630打印机,手把手为你解决win10系统安装630k打印机驱动的设置方法...
  10. 高级运维工程师证书_华为认证云运维高级工程师(HCIP-CDCO)
  11. 计算机 bat文件夹加密,无需第三方软件,自制批处理加密隐藏文件夹
  12. 关于ECMWF和ERA5没有近地面相对湿度数据的解决办法
  13. 最简单的基于FFmpeg的视频编码器-更新版(YUV编码为HEVC(H.265))
  14. 计算机工程与应用期刊模板,计算机工程与应用 论文模板
  15. svg练习题——抽风路径、高斯模糊、仪表盘、个性签名、loading加载
  16. 令人不寒而栗的黄蓉(转)
  17. 阿里云飞天计划体验-阿里云开发者社区
  18. 会员权益体系内容设计维度
  19. Python正则表达式中的转义问题\\\\\\\\\????(焯!什么鬼)
  20. .msu格式文件跳过windowupdate检测直接安装方案(vs2015安装提示0x80240037安装失败,KB2999226无法安装)

热门文章

  1. vue-router 响应路由参数的变化
  2. 如何写一个作用域安全的构造函数
  3. this到底指向哪里
  4. WPF 实现ScrollViewer的垂直偏移滚动跳转
  5. JS对url进行编码和解码(三种方式区别)
  6. 检测和删除多余无用的css
  7. Unity3D入门其实很简单
  8. oracle data guard --理论知识回顾02
  9. 五、创建Bean的三种方式
  10. KMP算法的java实现