abstract_api.timezone.timezone module#
- class abstract_api.timezone.timezone.Timezone(api_key: str | None = None)[source]#
Bases:
BaseServiceAbstractAPI timezone service.
Used to find, convert, and manage time and timezone data across the world.
- Attributes:
_subdomain: Timezone service subdomain.
- convert(base_location: str | list[float] | tuple[float, float], target_location: str | list[float] | tuple[float, float], base_datetime: str | None = None) TimezoneConversionResponse[source]#
Converts datetime of base location to target location’s datetime.
By default, it converts the current time, but the conversion can take place in either the past or future with a simple parameter.
- Args:
- base_location: The location you use as a base to convert the
datetime for. This parameter accepts the location as a string (e.g., Los Angeles, CA), a longitude and latitude (e.g., -31.4173391,-64.183319), or an IP address (e.g., 82.111.111.111).
- target_location: The location you want to get the datetime for.
This parameter accepts the location as a string (e.g., Los Angeles, CA), a longitude and latitude (e.g., -31.4173391,-64.183319), or an IP address (e.g., 82.111.111.111).
base_datetime: The datetime you’re converting.
- Returns:
TimezoneConversionResponse representing API call response.
- current(location: str | list[float] | tuple[float, float]) CurrentTimezoneResponse[source]#
Finds the current time, date, and timezone of a given location.
- Args:
- location: The location to determine the current time and
timezone of. This parameter accepts the location as a string (e.g., Los Angeles, CA), a longitude and latitude (e.g., -31.4173391,-64.183319), or an IP address (e.g., 82.111.111.111).
- Returns:
CurrentTimezoneResponse representing API call response.