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 objectTimeZone tz = TimeZone.getTimeZone("Africa/Asmera");// Display tzSystem.out.println("tz: " + tz);// By using useDaylightTime() method is to// check whether time zone tz use daylight time or// notboolean 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
總結
以上是生活随笔為你收集整理的java timezone_Java TimeZone useDaylightTime()方法与示例的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: Java ListResourceBun
- 下一篇: Java中List和Map接口之间的区别
