
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get the default Time Zone in Java
In order to get the default Time Zone in Java, we use the getDefault() method. The java.util.TimeZone.getDefault() method returns the default TimeZone for the particular host. The source of the default TimeZone varies with the implementation.
Declaration −The java.util.TimeZone.getDefault() method is declared as follows −
public static TimeZone getDefault()
Let us see a program to get the default time zone in Java −
Example
import java.util.*; public class Example { public static void main( String args[] ) { // creating default object of TimeZone TimeZone obj = TimeZone.getDefault(); System.out.println("Default timezone object: \n" + obj); } }
Output
Default timezone object: sun.util.calendar.ZoneInfo[id="Etc/UTC",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
- Related Questions & Answers
- Get all the IDs of the Time Zone in Java
- Get the IDs according to the given time zone offset in Java
- How do I get the current time zone of MySQL?
- Java Program to display Current Time in another Time Zone
- Set the base time zone offset to GMT in Java
- mysql_tzinfo_to_sql - Load the Time Zone Tables in MySQL
- Display time zone with SimpleDateFormat(“z”) in Java
- How to get current time zone in android using clock API class?
- Get the default system properties in Java
- How to use time zone in a JSP?
- How to set time zone in a JSP?
- Python Pandas - Convert Timestamp to another time zone
- How to return the time-zone offset in minutes for the current locale?
- Get elapsed time in Java
- Python Pandas - Convert naive Timestamp to local time zone
Advertisements