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.pswp.cn/news/379485.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/379485.shtml
英文地址,請注明出處:http://en.pswp.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…