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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈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…