getTimeZone(): This method is available in java.util.Calendar class of Java.
Syntax:
TimeZone java.util.Calendar.getTimeZone()
This method gets the time zone.
Parameters: NA
Returns: the time zone object associated with this calendar.
Exceptions: NA
Approach
Java
import java.util.Calendar;public class CalendargetTimeZone {public static void main(String[] args) {// create a calendarCalendar calendar = Calendar.getInstance();calendar.add(Calendar.DATE, 2);System.out.println(calendar.getTimeZone());}}
Output:
sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=7,lastRule=null]
No comments:
Post a Comment