Use our API Services to tap into timeanddate.com's databases and integrate our data into your applications
- astronomy – Get Information About Astronomical Objects.
- astrodata – Calculate data on Astronomical Objects on Specific Times.
- businessdate – Calculate business date from a given number of days.
- businessduration – Calculate business days in a specified date range.
- converttime – Convert Time Between Time Zones.
- dstlist – Retrieve Daylight Saving Time Information.
- holidays – Retrieve List of Holidays.
- places – Retrieve List of Available Places.
- timeservice – Retrieve Current Time for Place.
- Python 3.6
pip3 install libtad
from libtad import AstronomyService
from libtad.datatypes.places import Coordinates, LocationId
from libtad.datatypes.time import TADDateTime
from libtad.datatypes.astro import AstronomyEventClass, AstronomyObjectType
# Specify the location, and the dates you are querying for
coordinates = Coordinates(59.743, 10.204)
place = LocationId(coordinates)
date = TADDateTime(2020, 11, 26)
# To perform the query, you will need your access key and secret key
service = AstronomyService("accessKey", "secretKey")
# Select which astronomical events you are interested in
service.types = AstronomyEventClass.Meridian | AstronomyEventClass.Phase
# Retrieve astronomical information for specified astronomy object at a given time and place
astro_info = service.get_astronomical_info(AstronomyObjectType.Moon, place, date)
TadApi is owned and maintained by the Time and Date AS. You can visit our API Reference at timeanddate.com for project updates and releases.