java timezone_Java TimeZone setID()方法与示例
java timezone
TimeZone類的setID()方法 (TimeZone Class setID() method)
setID() method is available in java.util package.
setID()方法在java.util包中可用。
setID() method is used to set the id of this TimeZone.
setID()方法用于設置此TimeZone的ID。
setID() 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.
setID()方法是一種非靜態方法,只能通過類對象訪問,如果嘗試使用類名稱訪問該方法,則會收到錯誤消息。
setID() method does not throw an exception at the time of set id.
setID()方法在設置ID時不會引發異常。
Syntax:
句法:
public void setID(String ids);Parameter(s):
參數:
String ids – represents the assigned time zone id.
字符串ID –代表分配的時區ID。
Return value:
返回值:
The return type of the method is void, it returns nothing.
該方法的返回類型為void ,不返回任何內容。
Example:
例:
// Java program to demonstrate the example // of void setID(String ids) method of TimeZone import java.util.*;public class SetIDOfTimeZone {public static void main(String args[]) {// Instantiates TimeZone objectTimeZone tz = TimeZone.getDefault();// Display tzSystem.out.println("tz.getID(): " + tz.getID());// By using setID() method is to// set the id for this time zone tztz.setID("Africa/Asmera");// Display tzSystem.out.println("tz.setID(Africa/Asmera): " + tz.getID());} }Output
輸出量
tz.getID(): GMT tz.setID(Africa/Asmera): Africa/Asmera翻譯自: https://www.includehelp.com/java/timezone-setid-method-with-example.aspx
java timezone
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的java timezone_Java TimeZone setID()方法与示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c语言if else语句_查找C程序的输
- 下一篇: Java Duration类| isZe