All Projects → graphhopper → timezone

graphhopper / timezone

Licence: Apache-2.0 license
Timezone project providing a simple way to turn location and unix timestamp into timezone and local time.

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to timezone

Timezonefinder
fast python package for finding the timezone of any point on earth (coordinates) offline
Stars: ✭ 242 (+908.33%)
Mutual labels:  timezone
time machine
A date and time API for Dart
Stars: ✭ 120 (+400%)
Mutual labels:  timezone
llttz
The easy way to get java TimeZone from latitude/longitude
Stars: ✭ 27 (+12.5%)
Mutual labels:  timezone
Prayer Times Android Azan
Prayer + Time + Android + Kotlin + Azan + Library + timezone + islamic + salah + Library aiming to calculate prayer time with one line code , if you implement prayer time application , there is no need to do this headache again .
Stars: ✭ 251 (+945.83%)
Mutual labels:  timezone
Friend-Time
Discord bot - Friend Time helps your server coordinate times and events by converting times mentioned in chat between time zones!
Stars: ✭ 62 (+158.33%)
Mutual labels:  timezone
TimesDates.jl
Nanosecond resolution for Time and Date, TimeZones
Stars: ✭ 28 (+16.67%)
Mutual labels:  timezone
Django Easy Timezones
Easy timezones for Django based on GeoIP
Stars: ✭ 195 (+712.5%)
Mutual labels:  timezone
tz
Time zone support for Elixir
Stars: ✭ 73 (+204.17%)
Mutual labels:  timezone
temps-lite
A smart, good-looking little app which tries to speak your language the way you are used to.
Stars: ✭ 40 (+66.67%)
Mutual labels:  timezone
IP2Location-C-Library
IP2Location C library enables the user to find the country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather station code, weather station name, mobile, usage types, etc that any IP address or hostname originates from.
Stars: ✭ 37 (+54.17%)
Mutual labels:  timezone
Timezone-List
A small package use to create a timezone list box in Laravel
Stars: ✭ 51 (+112.5%)
Mutual labels:  timezone
sqlalchemy-utc
SQLAlchemy type to store aware datetime values
Stars: ✭ 87 (+262.5%)
Mutual labels:  timezone
Vytal
Browser extension to spoof timezone, geolocation, locale and user agent.
Stars: ✭ 1,449 (+5937.5%)
Mutual labels:  timezone
Soulvercore
A powerful Swift framework for evaluating mathematical expressions
Stars: ✭ 245 (+920.83%)
Mutual labels:  timezone
hs-hourglass
efficient and simpler time API for haskell
Stars: ✭ 43 (+79.17%)
Mutual labels:  timezone
Timezone
Arduino library to facilitate time zone conversions and automatic daylight saving (summer) time adjustments.
Stars: ✭ 205 (+754.17%)
Mutual labels:  timezone
timeshape
Java library to find timezone based on geo coordinates
Stars: ✭ 116 (+383.33%)
Mutual labels:  timezone
cldr-engine
Internationalization and localization in Typescript with Unicode CLDR, batteries included
Stars: ✭ 34 (+41.67%)
Mutual labels:  timezone
compact-timezone-list
Simple array of timezones with their long name, tz code, and UTC offset.
Stars: ✭ 33 (+37.5%)
Mutual labels:  timezone
countdown
jQuery CountDown Clock - Simple countdown plugin for product special offers
Stars: ✭ 33 (+37.5%)
Mutual labels:  timezone

timezone

Build Status

Requires Java 1.8.

Timezone Core

The timezone project can be imported into your project and run by directly interfacing with the public methods, without needing to start the web service. Add the project as a dependency and create a new TimeZones object, which can be interacted with through .getTimeZone() and .getOffsetDateTime() including all local time and timezone information such as current time in the timezone and offset from GMT.

Example:

TimeZones timeZones = new TimeZones();
timeZones.initWithWorldData(new File("./world-data/tz_world.shp").toURI().toURL());

TimeZone tz = timeZones.getTimeZone(40.713956,-75.767577);
long unixTimeStamp = 1488363179;
OffsetDateTime offsetDateTime = timeZones.getOffsetDateTime(unixTimeStamp,tz);
System.out.println(offsetDateTime);

//or even shorter
OffsetDateTime offsetDateTime2 = timeZones.getOffsetDateTime(unixTimeStamp,40.713956,-75.767577);
System.out.println(offsetDateTime2);

Timezone Webapp

Our timezone app turns your location and timestamp into timezone and local time. Thus, if you need local time in your application, just ask GraphHopper timezone. It is microservice you can run wherever you like.

Example

Example 1

request: http://localhost:8080/timezone?timestamp=1488363179&location=40.713956,-75.767577

response:

{

    "timezone": "America/New_York",
    "timezone_name": "Eastern Standard Time",
    "local_time": {
        "offset": -18000,
        "year": 2017,
        "month": "March",
        "day_of_month": 2,
        "day_of_week": "Thursday",
        "month_value": 3,
        "hour": 16,
        "minute": 19,
        "second": 52,
        "nano": 0
    }

}

Example 2

request: http://localhost:8080/timezone?timestamp=1488489592&location=48.873748,2.344482&language=fr

response:

{
    "timezone": "Europe/Paris",
    "timezone_name": "Heure d'Europe centrale",
    "local_time": {
        "offset": 3600,
        "year": 2017,
        "month": "mars",
        "day_of_month": 2,
        "day_of_week": "jeudi",
        "month_value": 3,
        "hour": 22,
        "minute": 19,
        "second": 52,
        "nano": 0
    }
}

Example 3

request: http://localhost:8080/timezone?timestamp=1488489592&location=36.031332,138.796876&language=ja

response:

{
    "timezone": "Asia/Tokyo",
    "timezone_name": "日本標準時",
    "local_time": {
        "offset": 32400,
        "year": 2017,
        "month": "3月",
        "day_of_month": 3,
        "day_of_week": "金曜日",
        "month_value": 3,
        "hour": 6,
        "minute": 19,
        "second": 52,
        "nano": 0
    }
}

try your own example:

Input & Output

You need to specify two parameters, (Unix) timestamp and location (lat,lon), and you will be provided with the according timezone, local time and offset to UTC. Local time and offset consider daylight saving time (dst).

Input:

Parameter Description
timestamp Unix timestamp (in seconds)
location latitude, longitude
language optional, default is 'en' - see the supported languages here

Output:

Name Description
timezone time zone id as defined here: http://efele.net/maps/tz/world/
timezone_name full name of time zone
local_time local time information considering daylight saving time

local_time:

Name Description
offset offset to UTC in seconds
year -
month -
day_of_month -
day_of_week -
month_value -
hour -
minute -
second -
nano -

TZ data

Make sure that you have updated your java environment with the latest tz data, otherwise old DST data might yield wrong local times. For example, such events "Russia Returns to Standard Time All Year" cause wrong local time calculations if you have not updated your JRE/JDK. You can update it as described here:

http://www.oracle.com/technetwork/java/javase/tzupdater-readme-136440.html

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].