java timezone_Java TimeZone useDaylightTime()方法與示例

java timezone

TimeZone類useDaylightTime()方法 (TimeZone Class useDaylightTime() method)

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

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

  • useDaylightTime() method is used to check whether this time zone uses daylight savings time or not.

    useDaylightTime()方法用于檢查此時區是否使用夏時制。

  • useDaylightTime() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.

    useDaylightTime()方法是一種非靜態方法,只能通過類對象訪問,如果嘗試使用類名稱訪問該方法,則會收到錯誤消息。

  • useDaylightTime() method does not throw an exception at the time of checking daylight savings.

    useDaylightTime()方法在檢查夏時制時不會引發異常。

Syntax:

句法:

    public abstract boolean useDaylightTime();

Parameter(s):

參數:

  • It does not accept any parameter.

    它不接受任何參數。

Return value:

返回值:

The return type of the method is boolean, it returns true when this time zone uses DST (daylight savings time) otherwise it returns false.

方法的返回類型為boolean ,當該時區使用DST(夏令時)時返回true,否則返回false。

Example:

例:

// Java program to demonstrate the example 
// of boolean useDaylightTime() method 
// of TimeZone 
import java.util.*;
public class UseDaylightTimeOfTimeZone {
public static void main(String args[]) {
// Instantiates two TimeZone object
TimeZone tz = TimeZone.getTimeZone("Africa/Asmera");
// Display tz
System.out.println("tz: " + tz);
// By using useDaylightTime() method is to
// check whether time zone tz use daylight time or
// not
boolean status = tz.useDaylightTime();
System.out.print("tz.useDaylightTime(): ");
System.out.println(status);
}
}

Output

輸出量

tz: sun.util.calendar.ZoneInfo[id="Africa/Asmera",offset=10800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null]
tz.useDaylightTime(): false

翻譯自: https://www.includehelp.com/java/timezone-usedaylighttime-method-with-example.aspx

java timezone

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/541893.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/541893.shtml
英文地址,請注明出處:http://en.pswp.cn/news/541893.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

視覺學習(4) —— 添加地址傳遞數據

Modbus Slave 選擇一個地址右鍵,選擇發送的數據類型 視覺軟件 一、添加地址 當地址為100時,先將首地址改為100,第0個地址為100,第1個地址為101,往后累加 若想使用100—150的地址,即首地址為100&#xff…

某個JAVA類斷點無效_解決eclipse中斷點調試不起作用的問題

最近幾天,遇到了一個問題,就是在eclipse中進行斷點調試程序到時候,跟蹤不到我設置的斷點。困惑了很久,在網上也查閱了很多資料,都沒能解決我的問題。今天早上,我試著把eclipse的工作空間重新換了一個&#…

jquery中阻止事件冒泡的方法

2019獨角獸企業重金招聘Python工程師標準>>> 根據《jquery基礎教程》 第一種方法:判斷事件的“直接”目標是否是自身,如果不是自身,不予處理 $(div.outter).click(function(event) {if (event.target this) {$(p).css(color, red…

java swing 組織機構_課內資源 - 基于Java Swing的小型社團成員管理系統

一、需求分析1.1 個人信息學號、姓名、性別、年級、系別、專業、出生日期、聯系方式、個性簽名、地址、照片。1.2 基本功能要求管理員信息管理登錄、注銷功能修改密碼功能部落成員信息管理添加成員刪除成員修改成員信息按條件查找篩選成員1.3 高級特性管理員權限管理成員信息包…

Java System類loadLibrary()方法與示例

系統類loadLibrary()方法 (System class loadLibrary() method) loadLibrary() method is available in java.lang package. loadLibrary()方法在java.lang包中可用。 loadLibrary() method is used to load the library with the given parameter named library_name(library …

CCF201509-2 日期計算(100分)

試題編號: 201509-2 試題名稱: 日期計算 時間限制: 1.0s 內存限制: 256.0MB 問題描述: 問題描述給定一個年份y和一個整數d,問這一年的第d天是幾月幾日?注意閏年的2月有29天。滿足下面條件之一的…

Java StringBuilder trimToSize()方法與示例

StringBuilder類trimToSize()方法 (StringBuilder Class trimToSize() method) trimToSize() method is available in java.lang package. trimToSize()方法在java.lang包中可用。 trimToSize() method is used to minimize storage used for the characters (i.e. if the init…

第一百四十一節,JavaScript,封裝庫--DOM加載

JavaScript,封裝庫--DOM加載 DOM加載,跨瀏覽器封裝DOM加載,當網頁文檔結構加載完畢后執行函數,不等待圖片音頻視頻等文件加載完畢 /** dom_jia_zai()函數,DOM頁面加載函數,等待頁面結構加載完畢后就執行函數…

java 使用接口便于維護程序_Java初學——面向對象接口的應用

一、接口1.什么是接口接口是比抽象類更抽象的定義,接口不可以被實例化 實現類必須實現接口的所有方法 實現類可以實現多個接口 、多個接口使用逗號隔開 接口中的變量都是靜態常量(public static final) 程序設計時面向接口的約定而不考慮具體實現 。2.為什么使用接口…

Java ResourceBundle getLocale()方法與示例

ResourceBundle類的getLocale()方法 (ResourceBundle Class getLocale() method) getLocale() method is available in java.util package. getLocale()方法在java.util包中可用。 getLocale() method is used to get the locale of this ResourceBundle. getLocale()方法用于獲…

centos下安裝pip時失敗:

2019獨角獸企業重金招聘Python工程師標準>>> [rootwfm ~]# yum -y install pip Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.tuna.tsinghua…

java 標準輸入流 關閉 打開_java輸出流關流疑問,以下這個程序的in和out是否要關閉?...

/**標準IOjava.lang.System類中提供以下三個靜態常量:staticfinalInputStreamin功能:“標準”輸入流,流已打開并準備提供輸入數據。通常,此流對應于鍵盤輸入或者由主機環境或用戶指.../**標準IOjava.lang.System類中提供以下三個靜…

Java RandomAccessFile readUTF()方法及示例

RandomAccessFile類readUTF()方法 (RandomAccessFile Class readUTF() method) readUTF() method is available in java.io package. readUTF()方法在java.io包中可用。 readUTF() method is used to read this RandomAccessFile as a string. readUTF()方法用于以字符串形式讀…

LCD顯示屏原理與應用

1、什么是LCD? (1)LCD(Liquid Crystal Display)俗稱液晶.(2)液晶是一種材料,液晶這種材料具有一種特點:可以在電信號的驅動下液晶分子進行旋轉,旋轉時會影響透光性,因此我們可以在整個液晶面板后面用白光照&#xff08…

Java PipedInputStream connect()方法與示例

PipedInputStream類的connect()方法 (PipedInputStream Class connect() method) connect() method is available in java.io package. connect()方法在java.io包中可用。 connect() method is used to cause this PipedInputStream to be connected to the given PipedOutputS…

java寫手機游戲_如何將自己編寫的JAVA小游戲寫到手機里?

2019-06-19怎么用java編寫獲取星期幾的程序&#xff1f;import java。util。*; public class WeekDay { Calendar date Calendar。getInstance(); private int getMaxDate(int moth){ moth moth -1; if(moth > 12 || moth < 0){ System。 out。println("輸入月份錯…

Java PipedInputStream receive()方法與示例

PipedInputStream類的receive()方法 (PipedInputStream Class receive() method) receive() method is available in java.io package. receive()方法在java.io包中可用。 receive() method is used to receive a byte of content and it will block when no more input remain…

java去除重復對象_Java19-2 集合類去除重復對象

List獨有方法&#xff1a;import java.util.ArrayList;import java.util.List;public class ListTest2 {public static void main(String[] args) {List listnew ArrayList();list.add("abc1");list.add("abc2");list.add("abc1");list.add(&quo…

SSM框架整合中遇到重復的問題Ambiguous handler methods mapped for HTTP

嚴重: Servlet.service() for servlet [spring] in context with path [/ssmDemo] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: Ambiguous handler methods mapped for HTTP path /init.do: {public java.lang.String …

Java ObjectStreamClass lookup()方法與示例

ObjectStreamClass類lookup()方法 (ObjectStreamClass Class lookup() method) lookup() method is available in java.io package. lookup()方法在java.io包中可用。 lookup() method is used to lookup the descriptor for a class that can be serialized. lookup()方法用于…