Class GoogleTimeZone

java.lang.Object
org.kissweb.googleMapsAPI.GoogleTimeZone

public class GoogleTimeZone extends Object
This class returns the timezone ID associated with a latitude/longitude.

Author: Blake McBride
Date: 3/5/22
  • Constructor Details

    • GoogleTimeZone

      public GoogleTimeZone()
  • Method Details

    • getTimezone

      public static String getTimezone(double latitude, double longitude) throws IOException
      Perform a timezone query.

      Example:
       String timezoneID = GoogleMapsAPI.getTimezone(38.234567, -85.003456);
       
      Parameters:
      latitude - latitude
      longitude - longitude
      Returns:
      timeZoneId
      Throws:
      IOException
    • getTimezone

      public static String getTimezone(String address) throws IOException
      Perform a timezone query based on an address.

      Example:
       String timezoneID = GoogleMapsAPI.getTimezone("1600 Amphitheatre Parkway, Mountain View, CA");
       
      Parameters:
      address - address
      Returns:
      timeZoneId
      Throws:
      IOException
    • getTimezone

      public static String getTimezone(String street1, String street2, String city, String state, String zip) throws IOException
      Perform a timezone query based on an address broken into its parts.

      Example:
       String timezoneID = GoogleMapsAPI.getTimezone("1600 Amphitheatre Parkway", null, "Mountain View", "CA", "94043");
       
      Parameters:
      street1 - street address 1
      street2 - street address 2 (optional)
      city - city
      state - state
      zip - zip code (optional)
      Returns:
      timeZoneId
      Throws:
      IOException