Class TimeZoneUtils
java.lang.Object
overit.geocallapp.utilities.core.timezone.TimeZoneUtils
Utility class providing time zone resolution and date conversion operations.
This class offers static methods for resolving time zones using annotation-based configuration and converting dates between different timezone representations. It supports automatic time zone resolution through
This class offers static methods for resolving time zones using annotation-based configuration and converting dates between different timezone representations. It supports automatic time zone resolution through
TimeZoneResolver annotations and provides various date conversion
utilities for working with ZonedDateTime and Date objects. - Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic DategetCentralDate(ZonedDateTime source) Converts aZonedDateTimeto a centralDatein the application server timezone.static ZonedDateTimeConverts aDateto a central or symbolicZonedDateTimewithout changing time or timezone.static DategetLocalDate(ZonedDateTime source, TimeZone timeZone) Converts aZonedDateTimeto a localDateusing the specified timezone.static ZonedDateTimegetLocalZonedDateTime(Date source, TimeZone timeZone) Converts aDateto a localZonedDateTimewith the specified timezone.static DategetSymbolicDate(ZonedDateTime source) Converts aZonedDateTimeto a symbolicDatewithout changing the date value.static final <T> TimeZonegetTimeZone(Class<?> cls, Object firstItem, Object secondItem) Resolves aTimeZoneusing annotation-based configuration with fallback objects.
-
Method Details
-
getTimeZone
Resolves aTimeZoneusing annotation-based configuration with fallback objects.- Type Parameters:
T- the type of data used for timezone resolution- Parameters:
cls- the class to check forTimeZoneResolverannotationfirstItem- the primary object to extract timezone data fromsecondItem- the fallback object to extract timezone data from- Returns:
- the resolved
TimeZone, or system default if resolution fails
-
getLocalDate
- Parameters:
source- theZonedDateTimeto converttimeZone- the targetTimeZonefor conversion- Returns:
- the converted local
Date, or null if source is null
-
getCentralDate
- Parameters:
source- theZonedDateTimeto convert- Returns:
- the converted central
Date, or null if source is null
-
getSymbolicDate
- Parameters:
source- theZonedDateTimeto convert- Returns:
- the converted symbolic
Date, or null if source is null
-
getLocalZonedDateTime
- Parameters:
source- theDateto convert (in application server timezone)timeZone- the targetTimeZonefor the output- Returns:
- the converted local
ZonedDateTime
-
getCentralOrSymbolicZonedDateTime
- Parameters:
source- theDateto convert- Returns:
- the converted central/symbolic
ZonedDateTime
-