Convert Meeting Time Across TimeZones

🔑

Do You Have Your Access Token?

Before you proceed, ensure you have your access token at hand. Can't find your token? No worries — our guide will assist you in either creating a new one or finding your existing token.

LocationIQ's Timezone API provides a convenient way to convert meeting times from one timezone to another. This guide will walk you through the process of using the LocationIQ Timezone API to convert a meeting time from UK time to multiple other timezones.

1. Gather Meeting Details

Collect the necessary information for the meeting:

  • Meeting time in UK timezone (e.g., 9:00 AM UK time)
  • Latitude and Longitude of the meeting location

2. Craft the API Request

Replace the placeholders in the API URL with your actual API access token, latitude, and longitude:

https://us1.locationiq.com/v1/timezone?key=YOUR_ACCESS_TOKEN&lat=LATITUDE&lon=LONGITUDE

3. Make API Requests

Use the crafted API URL to fetch timezone information for each desired timezone:

  • California: https://us1.locationiq.com/v1/timezone?key=YOUR_ACCESS_TOKEN&lat=36.7783&lon=-119.4179
  • New York: https://us1.locationiq.com/v1/timezone?key=YOUR_ACCESS_TOKEN&lat=40.7128&lon=-74.0060
  • Berlin: https://us1.locationiq.com/v1/timezone?key=YOUR_ACCESS_TOKEN&lat=52.5200&lon=13.4050
  • Singapore: https://us1.locationiq.com/v1/timezone?key=YOUR_ACCESS_TOKEN&lat=1.3521&lon=103.8198
  • Beijing: https://us1.locationiq.com/v1/timezone?key=YOUR_ACCESS_TOKEN&lat=39.9042&lon=116.4074

For each timezone, you will get a response containing information like the timezone name, offset, and short name.

4. Convert Meeting Time

For each timezone, calculate the converted meeting time using the offset provided in the API response. You can adjust the meeting time by adding or subtracting the offset in seconds.

timezones = {
    "California": -25200,  # Offset in seconds (-7 hours)
    "New York": -14400,     # Offset in seconds (-4 hours)
    "Berlin": 7200,        # Offset in seconds (+2 hours)
    "Singapore": 28800,     # Offset in seconds (+8 hours)
    "Beijing": 28800          # Offset in seconds (+8 hours)
}

5. Present the Results

Display the original meeting time in UK timezone and the converted meeting times for each desired timezone.

Example Code (Python)

Here's a simplified example in Python to demonstrate the process:

import requests

base_url = "https://us1.locationiq.com/v1/timezone?key=YOUR_ACCESS_TOKEN&lat=LATITUDE&lon=LONGITUDE"
meeting_time_uk = "09:00"  # UK time

timezones = {
    "California": -25200,  # Offset in seconds (-7 hours)
    "New York": -14400,     # Offset in seconds (-4 hours)
    "Berlin": 7200,        # Offset in seconds (+2 hours)
    "Singapore": 28800,     # Offset in seconds (+8 hours)
    "Beijing": 28800          # Offset in seconds (+8 hours)
}

for city, offset in timezones.items():
    api_url = base_url.replace("LATITUDE", "YOUR_LATITUDE").replace("LONGITUDE", "YOUR_LONGITUDE")
    response = requests.get(api_url)
    timezone_info = response.json()["timezone"]
    converted_time = (datetime.strptime(meeting_time_uk, "%H:%M") + timedelta(seconds=offset)).strftime("%H:%M")
    print(f"Meeting time in {city}: {converted_time}")
<?php
$base_url = "https://us1.locationiq.com/v1/timezone?key=YOUR_ACCESS_TOKEN&lat=LATITUDE&lon=LONGITUDE";
$meeting_time_uk = "09:00";  // UK time

$timezones = array(
    "California" => -25200,   // Offset in seconds (-7 hours)
    "New York" => -14400,     // Offset in seconds (-4 hours)
    "Berlin" => 7200,        // Offset in seconds (+2 hours)
    "Singapore" => 28800,     // Offset in seconds (+8 hours)
    "Beijing" => 28800          // Offset in seconds (+8 hours)
);

foreach ($timezones as $city => $offset) {
    $api_url = str_replace("LATITUDE", "YOUR_LATITUDE", str_replace("LONGITUDE", "YOUR_LONGITUDE", $base_url));
    $response = file_get_contents($api_url);
    $timezone_info = json_decode($response, true)["timezone"];
    $converted_time = date("H:i", strtotime($meeting_time_uk) + $offset);
    echo "Meeting time in $city: $converted_time<br>";
}
?>

const base_url = "https://us1.locationiq.com/v1/timezone?key=YOUR_ACCESS_TOKEN&lat=LATITUDE&lon=LONGITUDE";
const meetingTimeUK = "09:00";  // UK time

const timezones = {
    "California": -25200,   // Offset in seconds (-7 hours)
    "New York": -14400,     // Offset in seconds (-4 hours)
    "Berlin": 7200,        // Offset in seconds (+2 hours)
    "Singapore": 28800,     // Offset in seconds (+8 hours)
    "Beijing": 28800          // Offset in seconds (+8 hours)
};

for (const city in timezones) {
    const api_url = base_url.replace("LATITUDE", "YOUR_LATITUDE").replace("LONGITUDE", "YOUR_LONGITUDE");
    
    fetch(api_url)
        .then(response => response.json())
        .then(data => {
            const offset = timezones[city];
            const convertedTime = new Date(new Date(`2023-01-01T${meetingTimeUK}:00Z`).getTime() + offset * 1000).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
            console.log(`Meeting time in ${city}: ${convertedTime}`);
        })
        .catch(error => console.error(error));
}

Remember to replace YOUR_ACCESS_TOKEN, YOUR_LATITUDE, and YOUR_LONGITUDE with your actual information.