日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Java SimpleTimeZone setEndRule()方法与示例

發布時間:2023/12/1 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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 SimpleTimeZoneimport java.util.*;public class SetEndRuleOfSimpleTimeZone {public static void main(String args[]) {// Instantiates SimpleTimeZone objectSimpleTimeZone 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 dates_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 dates_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 SimpleTimeZoneSystem.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()方法与示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。