Java GregorianCalendar getTimeZone()方法與示例

GregorianCalendar類的getTimeZone()方法 (GregorianCalendar Class getTimeZone() method)

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

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

  • getTimeZone() method is used to return the time zone for this GregorianCalendar object.

    getTimeZone()方法用于返回此GregorianCalendar對象的時區。

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

    getTimeZone()方法是一種非靜態方法,因此可以通過類對象進行訪問,如果嘗試使用類名稱訪問該方法,則會收到錯誤消息。

  • getTimeZone() method does not throw an exception at the time of returning time zone for this Calendar.

    返回此日歷的時區時, getTimeZone()方法不會引發異常。

Syntax:

句法:

    public TimeZone getTimeZone();

Parameter(s):

參數:

  • It does not accept any parameter.

    它不接受任何參數。

Return value:

返回值:

The return type of this method is TimeZone, it returns time zone for this GregorianCalendar.

此方法的返回類型為TimeZone ,它返回此GregorianCalendar的時區。

Example:

例:

// Java program is to demonstrate the example of
// getTimeZone() method of GregorianCalendar
import java.util.*;
public class GetTimeZoneOfGregorianCalendar {
public static void main(String args[]) {
// Instantiating a GregorianCalendar object
GregorianCalendar ca = (GregorianCalendar) GregorianCalendar.getInstance();
System.out.println("ca.getTime(): " + ca.getTime());
//By using getTimeZone() method is to
//return the time zone of this GregorianCalendar
TimeZone time_zone = ca.getTimeZone();
//Display time zone of this GregorianCalendar
System.out.println("ca.getTimeZone(): " + time_zone.getDisplayName());
}
}

Output

輸出量

ca.getTime(): Sat Feb 15 11:55:40 GMT 2020
ca.getTimeZone(): Greenwich Mean Time

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

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

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

相關文章

python安全攻防---信息收集---ICMP主機探測 以及optionparser的使用

0x01 基礎概念 ICMP(Internet control Message Protocal)Internet報文協議,是TCP/IP的一種子協議,屬于網絡層協議,其目的是用于在IP主機、路由器之間傳遞控制信息 0x02 程序 程序 # -*- coding:utf-8 -*- from sca…

PHP文件系統-文件下載

一、網頁請求和響應的過程 請求: 1. HTTP 1.1 協議 版本 2. 頭信息,請求的ip,其他 3. 你請求的表單信息, 你提交給服務器的信息 http://localhost/one.php?aabbb&cccdd 響應: 1. 狀態 200 ok 404 頁面沒找到 2. 響應頭信息&a…

Java——網絡編程練習

練習一(黑馬程序員面試題):客戶端向服務器寫字符串(鍵盤錄入),服務器(多線程)將字符串反轉后寫回,客戶端再次讀取到的是反轉后的字符串 相關代碼如下: package com.wsq.test;import java.io.BufferedReader; import java.io.Buf…

第一章 基礎知識---1.4Crack小實驗--復現

0x01 程序及其編譯環境 程序如下&#xff0c;功能&#xff1a;我們必須輸入正確的密碼1234567才能得到密碼驗證的確認&#xff0c;跳出循環。否則程序提示密碼錯誤再次輸入。 #include <stdio.h>#define PASSWORD "1234567"int verify_password(char* passwo…

.net中調用exchange服務器發郵件

普通的郵件, 用System.Net.Mail 類 或 System.Web.Mail 類 處理即可, 但是Exchange Server 環境下, 這兩個類起不了作用-------至少目前我看到的情況如此. 整個過程如下: 1. 先添加COM 引用 "Microsoft CDO for Windows 2000 Library" .2. 發送郵件的代碼: CDO.Messa…

Java Double類doubleToLongBits()方法與示例

Double類doubleToLongBits()方法 (Double class doubleToLongBits() method) doubleToLongBits() method is available in java.lang package. doubleToLongBits()方法在java.lang包中可用。 doubleToLongBits() method follows IEEE 754 double floating-point standards and …

Firefox(火狐瀏覽器)彩蛋

①在地址欄上輸入&#xff1a; about:mozilla ②在地址欄上輸入&#xff1a; about:robots ③在地址欄上輸入&#xff1a; www.figma.com/404/ ④地址欄上輸入&#xff1a; chrome://global/content/alerts/alert.xul

jquery.history插件在ie中失效的問題

hash標志中不能有? ff中不存在這個問題。 轉載于:https://www.cnblogs.com/xyun/archive/2008/12/01/1345188.html

Java——反射(Class.forName()讀取配置文件舉例).

榨汁機(Juicer)榨汁機的案例&#xff1a; 分別有水果(Fruit),蘋果(Apple)&#xff0c;香蕉(Bananal)&#xff0c;橘子(Orange),榨汁(squeeze) 要求&#xff1a; 榨出不同的水果汁來喝 //一般方法求解 package com.testl;public class Text1 {public static void main(Strin…

java 根據類名示例化類_Java類類getEnclosingClass()方法及示例

java 根據類名示例化類類的類getEnclosingClass()方法 (Class class getEnclosingClass() method) getEnclosingClass() method is available in java.lang package. getEnclosingClass()方法在java.lang包中可用。 getEnclosingClass() method is used to return recent or im…

C++:cin.getline

轉&#xff1a;百度百科 http://baike.baidu.com/view/2383876.htm cin.getline 此函數是按行讀取,其語法為:cin.getline(字符指針,字符個數N,結束符); 功能是&#xff1a;一次讀取多個字符(包括空白字符&#xff09;&#xff0c;直到讀滿N-1個&#xff0c;或者遇到指定的結束符…

端口復用和重映射--STM32F103

什么是端口復用&#xff1f; STM32中有很多內置外設&#xff0c;這些外設的引腳都是與GPIO復用的&#xff0c;什么時候復用呢&#xff1f;就是當一個GPIO作為內置外設引腳使用時&#xff0c;就叫做復用。比如串口1的發送接收引腳是PA9&#xff0c;PA10&#xff0c;當PA9&#…

考研數學

眼前儼然一副冬的氣象&#xff0c;伴隨氣溫的驟降&#xff0c;考研復習也進入異常緊張的階段。在考試前這兩個月里&#xff0c;考生如何復習數學&#xff0c;成績還可以有所提高。萬學?海文數學教研組針對沖刺階段數學復習歸納總結以下復習經驗和建議&#xff0c;供大家參考。…

一個很好的自學網站~推薦一下

http://www.51zxw.net/study.asp?vip15746908

[轉]Ubuntu遠程桌面登陸

原文地址&#xff1a;http://www.cnblogs.com/xdzone/archive/2011/03/10/1979644.html 1.xp下默認的遠程桌面協議是rdp&#xff0c;默認端口3389&#xff0c;而ubuntu用的時vnc&#xff1a;默認端口5900 2.首先被訪問的主機&#xff08;windows/linux&#xff09;都要設置為允…

NVIC中斷管理---STM32

NVIC&#xff1a;嵌套向量中斷控制器 在了解中斷之前&#xff0c;我們先了解搶占優先級和響應優先級 搶占優先級和響應優先級 搶占優先級決定能不能打斷&#xff0c;高優先級的搶占可以中斷低優先級的搶占響應優先級在搶占優先級相同時&#xff0c;高響應優先級先執行&#x…

Java BigDecimal stripTrailingZeros()方法與示例

BigDecimal類stripTrailingZeros()方法 (BigDecimal Class stripTrailingZeros() method) stripTrailingZeros() method is available in java.math package. stripTrailingZeros()方法在java.math包中可用。 stripTrailingZeros() method is used to get a BigDecimal that is…

外部中斷---STM32F1

外部中斷概述 STM32的中斷控制器支持19個外部中斷/事件請求&#xff1a; 線0-15&#xff1a;對應外部IO口的輸入中斷線16&#xff1a;連接到PVD輸出線17&#xff1a;連接到RTC鬧鐘事件線18&#xff1a;連接到USB喚醒事件 STM32每個IO口都有可以作為外部中斷輸入&#xff0c;…

轉:點9圖

關于”點九” 轉&#xff1a;http://mux.baidu.com/?p1506“點九”是andriod平臺的應用軟件開發里的一種特殊的圖片形式&#xff0c;文件擴展名為&#xff1a;.9.png 智能手機中有自動橫屏的功能,同一幅界面會在隨著手機(或平板電腦)中的方向傳感器的參數不同而改變顯示的方向…

Python HTMLCalendar類| 帶實例的formatyear()方法

Python HTMLCalendar.formatyear()方法 (Python HTMLCalendar.formatyear() Method) formatyear() method is an inbuilt method of the HTMLCalendar class of calendar module in Python. It works on HTMLCalendar class object and returns an HTML table consisting of th…