Time Zone Map Data

A library for getting time zone information from location data.

License

License

Categories

Categories

Data
GroupId

GroupId

us.dustinj.timezonemap
ArtifactId

ArtifactId

timezonemap-data
Last Version

Last Version

4.5
Release Date

Release Date

Type

Type

jar
Description

Description

Time Zone Map Data
A library for getting time zone information from location data.

Download timezonemap-data

How to add to project

<!-- https://jarcasting.com/artifacts/us.dustinj.timezonemap/timezonemap-data/ -->
<dependency>
    <groupId>us.dustinj.timezonemap</groupId>
    <artifactId>timezonemap-data</artifactId>
    <version>4.5</version>
</dependency>
// https://jarcasting.com/artifacts/us.dustinj.timezonemap/timezonemap-data/
implementation 'us.dustinj.timezonemap:timezonemap-data:4.5'
// https://jarcasting.com/artifacts/us.dustinj.timezonemap/timezonemap-data/
implementation ("us.dustinj.timezonemap:timezonemap-data:4.5")
'us.dustinj.timezonemap:timezonemap-data:jar:4.5'
<dependency org="us.dustinj.timezonemap" name="timezonemap-data" rev="4.5">
  <artifact name="timezonemap-data" type="jar" />
</dependency>
@Grapes(
@Grab(group='us.dustinj.timezonemap', module='timezonemap-data', version='4.5')
)
libraryDependencies += "us.dustinj.timezonemap" % "timezonemap-data" % "4.5"
[us.dustinj.timezonemap/timezonemap-data "4.5"]

Dependencies

compile (3)

Group / Artifact Type Version
org.apache.commons : commons-compress jar 1.20
com.github.luben : zstd-jni jar 1.4.9-5
org.jetbrains.kotlin : kotlin-stdlib-jdk7 jar 1.4.32

provided (1)

Group / Artifact Type Version
us.dustinj.timezonemap : timezonemap-builder jar 4.5

test (6)

Group / Artifact Type Version
junit : junit jar 4.13.2
org.mockito : mockito-core jar 3.9.0
org.assertj : assertj-core jar 3.19.0
nl.jqno.equalsverifier : equalsverifier jar 3.6
com.google.guava : guava jar 30.1.1-jre
org.jetbrains.kotlin : kotlin-test jar 1.4.32

Project Modules

There are no modules declared in this project.

Time Zone Map

Maven Central Build Status Code Coverage Dependencies

The time zone map library provides a convenient way of determining the relevant time zone for any location on earth. The map hails from timezone-boundary-builder, which is derived from OpenStreetMap data. The idea, and the overall design pattern, comes from Timeshape.

This library seeks to:

  • Present a clean and simple API.
  • Be as fast and small as possible, with minimal dependencies, lending itself well to mobile applications.
  • Expose the region covered by each time zone to enable custom logic.
  • Handle overlapping time zones deterministically.
  • Conserve memory by not loading regions that are unnecessary.
  • Avoid dependencies on Java 8's time library, for mobile as well as legacy applications.

Examples

import us.dustinj.timezonemap.TimeZoneMap;

// Initialize of a region that spans from Germany to Bulgaria.
// Takes some time (~1-5 seconds) to initialize, so try and initialize only once and keep it.
TimeZoneMap map = TimeZoneMap.forRegion(43.5, 8.0, 53.00, 26.0);

String berlin = map.getOverlappingTimeZone(52.518424, 13.404776).get().getZoneId(); // Returns "Europe/Berlin"
String prague = map.getOverlappingTimeZone(50.074154, 14.437403).get().getZoneId(); // Returns "Europe/Prague"
String budapest = map.getOverlappingTimeZone(47.49642, 19.04970).get().getZoneId(); // Returns "Europe/Budapest"
String milan = map.getOverlappingTimeZone(45.466677, 9.188258).get().getZoneId();   // Returns "Europe/Rome"
String adriaticSea = map.getOverlappingTimeZone(44.337, 13.8282).get().getZoneId(); // Returns "Etc/GMT-1"

If you're on Java 8 or above, you can convert the returned time zone into a proper java.util.TimeZone:

java.util.TimeZone timeZone = java.util.TimeZone.getTimeZone(berlin);
timeZone.observesDaylightTime(); // Returns true

Getting the library

Maven

<dependency>
    <groupId>us.dustinj.timezonemap</groupId>
    <artifactId>timezonemap</artifactId>
    <version>4.5</version>
</dependency>

Android

This library has been tested down to Android SDK 19 (KitKat 4.4), which was released in 2013.

implementation('us.dustinj.timezonemap:timezonemap:4.5`) {
    // Exclude standard compression library
    exclude group: 'com.github.luben', module: 'zstd-jni'
}
// Import aar for native component compilation
implementation 'com.github.luben:zstd-jni:1.4.9-5@aar'

Licenses

The code of the library is licensed under the MIT License.

The time zone data contained in library is licensed under the Open Data Commons Open Database License (ODbL).

Versions

Version
4.5
4.0
3.4
3.3
3.2
3.1
3.0
2.0
1.0