JUHE API Marketplace
API Service

Time Zone

Determines the correct time zone, daylight saving time (DST) offset, and raw offset for any location.

99.9%
Uptime
32ms
Avg Response
10K+
Daily Requests
Time Zone Response
1{
2 "code": "200",
3 "msg": "Success",
4 "data": {
5 "timezone_id": "America/Los_Angeles",
6 "dst_offset": 3600,
7 "raw_offset": -28800
8 }
9}
JSON9 lines

API Introduction

About this API

The Time Zone API is a key tool for solving complex time issues in globalized applications. It can accurately return the time zone information for any geographical location based on its latitude and longitude coordinates. A single API call can obtain the location's IANA Time Zone Database ID (e.g., America/New_York), its raw offset from Coordinated Universal Time (UTC) (raw_offset), and whether it is currently in Daylight Saving Time (DST) and its offset (dst_offset). For any application that needs to handle users across time zones, schedule international meetings, record global events, or display localized time, this API is an indispensable infrastructure. It completely removes the burden of complex time zone calculations and daylight saving time rule management from developers.

Key Features

  • Precise Coordinate-based Query: Simply provide latitude and longitude coordinates to query the time zone information for any point on Earth.
  • IANA Time Zone ID: Returns the standard IANA time zone identifier (e.g., Asia/Shanghai), which is the best practice for handling time zones in all modern programming languages and systems.
  • UTC Offset: Provides the time zone's raw time offset from UTC (in seconds), which is the basis for calculating local time.
  • Daylight Saving Time (DST) Handling: Automatically calculates and returns the daylight saving time offset for the current or a specified time, so developers no longer need to manually maintain the complex and ever-changing global daylight saving time rules.
  • Localized Time Zone Name: Advanced versions can return localized time zone names (e.g., "Pacific Daylight Time") based on the request, improving the user experience.

Use Cases

Scenario 1: Build a Globalized Online Meeting or Event Scheduling System

Situation: An online collaboration platform (like a competitor to Zoom or Google Calendar) needs to allow users in different time zones to schedule and attend meetings without ambiguity. Implementation: When a meeting organizer (e.g., in New York) schedules a "9:00 AM" meeting, the system records the timestamp and the organizer's time zone (America/New_York). When an attendee in London views this meeting invitation, the system gets the attendee's geographical location and queries their time zone as Europe/London through the Time Zone API. Then, the system uses these two time zone pieces of information to correctly display the meeting time as "2:00 PM" London local time and clearly marks the time zone. This avoids all misunderstandings and missed meetings caused by time zone confusion.

Scenario 2: Display Localized Posting Times on Social Media or Content Platforms

Situation: A global social media platform wants users to see the posting time in their own local time when browsing posts. Implementation: When a user posts, the server records the timestamp of the event in UTC standard time. When another user browses this post, the front-end application first gets the browsing user's geographical location (possibly through the browser API or IP location), and then calls the Time Zone API to get their time zone ID. The front-end JavaScript code then uses this time zone ID and the post's UTC timestamp to format the time for display in the user's local time, for example, displaying the UTC timestamp as "2 hours ago" or "3:15 PM." This localized display greatly improves the readability and friendliness of the content.

Scenario 3: Synchronize Log Times in an Internet of Things (IoT) Device Management Platform

Situation: A company has deployed thousands of IoT devices (such as environmental sensors) globally and needs to display the logs and events of all devices on a central dashboard and ensure the accuracy of the timestamps. Implementation: Each IoT device records the latitude and longitude of its deployment location upon installation. When the device management platform receives log data from a device, it will query its time zone based on the device's latitude and longitude by calling the Time Zone API. The platform will uniformly convert and store all log's original timestamps (which may be the device's local time) as UTC time. When displaying on the front-end dashboard, the UTC time will be converted to the local time of the administrator viewing the log according to their time zone. This ensures that the time sequence of all events is consistent and comparable globally, which is crucial for troubleshooting and data analysis.

How it Works: Endpoints & Response

This API returns the detailed time zone information of a location by receiving its latitude and longitude coordinates as the core input.

Endpoint Example: https://hub.juheapi.com/timezone/v1/query

The JSON object of the response contains all the key data needed to handle time zones. timezone_id is the standard IANA time zone name, which can be used directly in the date and time libraries of most programming languages. raw_offset is the time zone's base UTC offset (in seconds). dst_offset is the daylight saving time offset (in seconds), which is 0 if it is not currently in daylight saving time. To calculate the current local time of a place, you only need to add raw_offset and dst_offset to the UTC time. This concise design provides developers with a powerful and simple time zone solution.

Quick Actions

Pricing

$0.00
for 10K requests
Ultra-low cost per request

Key Features

Real-time Processing
High Accuracy
Low Latency
Scalable Infrastructure