public class Timezone extends Object
Timezone
class represents timezone information.
It contains various attributes such as timezone name, offset, date, and time-related details.
The Timezone class provides several methods to access the attributes of the
Timezone object. For example, the getDateTimeTxt()
method returns the date and time.
Modifier and Type | Method and Description |
---|---|
String |
getDate()
Returns the current date in the format "yyyy-MM-dd"..
|
String |
getDateTime()
Returns the current date and time in the format "yyyy-MM-dd HH:mm:ss".
|
String |
getDateTimeTxt()
Returns date and time in the format "EEEE, MMMM dd, yyyy HH:mm:ss".
|
BigDecimal |
getDateTimeUnix()
Returns the current date and time in Unix timestamp format.
|
String |
getDateTimeWti()
Returns date and time in the format "EEE, dd MMM yyyy HH:mm:ss Z".
|
String |
getDateTimeYmd()
Returns date and time in the format "yyyy-MM-dd'T'HH:mm:ssZ".
|
int |
getDSTSavings()
Returns the amount of time saved during DST.
|
TimezoneGeo |
getGeo()
Returns the Geolocation associated with the timezone.
|
int |
getMonth()
Returns the current month.
|
String |
getTime12()
Returns the current time in 12-hour format.
|
String |
getTime24()
Returns the current time in 24-hour format.
|
String |
getTimezone()
Returns the timezone ID.
|
int |
getTimezoneOffset()
Returns the timezone offset from UTC.
|
int |
getTimezoneOffsetWithDST()
Returns the timezone offset with daylight saving time (DST) from UTC.
|
int |
getWeek()
Returns the current week number.
|
int |
getYear()
Returns the current year.
|
String |
getYearAbbr()
Returns the abbreviated form of the current year like "24".
|
boolean |
isDST()
Indicates whether Daylight Saving Time (DST) is observed.
|
String |
toString()
Returns a JSON representation of the user agent data.
|
public String getTimezone()
public int getTimezoneOffset()
public int getTimezoneOffsetWithDST()
public String getDate()
public String getDateTime()
public String getDateTimeTxt()
public String getDateTimeWti()
public String getDateTimeYmd()
public BigDecimal getDateTimeUnix()
public String getTime24()
public String getTime12()
public int getWeek()
public int getMonth()
public int getYear()
public String getYearAbbr()
public boolean isDST()
True
if DST is observed, otherwise false
.public int getDSTSavings()
public TimezoneGeo getGeo()
TimezoneGeo
associated with the timezone.Copyright © 2024. All rights reserved.