Holidays API: Documentation
Get Started with our Holidays APIs
Get information on holidays and observances around the world – with a few lines of code in your language of choice.
Install Official Libraries
To get started, use one of timeanddate.com's official API libraries for your programming language. If your language isn't supported, you can send the requests manually over HTTP. If you would like to request an official library for your language, please contact us.
$ git clone https://github.com/timeanddate/libtad-net
Build Query
The API library is now installed. Next, you specify the kind of holidays you want to request, the country, and the year. You can find all available countries in our country overview.
To perform the query, you will need your access key and secret key: Get them from the Access Key page on My Account. Don't have a key? Sign up for our free trial and receive an access key to try it out.
var country = "no";
var service = new HolidaysService('accessKey', 'secretKey');
service.Types = HolidayType.Federal | HolidayType.Weekdays;
Get Result
The result
variable will now contain all national, state, and religious holidays for Norway in the year 2020.
var result = service.GetHolidaysForCountry(country, 2020);
Where to go next?
See our GitHub repository for more information on the C#/.NET Library.
<repository>
<id>github</id>
<name>Time and Date API Packages</name>
<url>https://maven.pkg.github.com/timeanddate/libtad-jvm</url>
</repository>
<dependency>
<groupId>com.timeanddate</groupId>
<artifactId>services</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
Build Query
The API library is now installed. Next, you specify the kind of holidays you want to request, the country, and the year. You can find all available countries in our country overview.
To perform the query, you will need your access key and secret key: Get them from the Access Key page on My Account. Don't have a key? Sign up for our free trial and receive an access key to try it out.
String country = "no";
HolidaysService service = new HolidaysService('accessKey', 'secretKey');
service.Types = EnumSet.of(HolidayType.Federal, HolidayType.Weekdays, HolidayType.Religious);
Get Result
The result
variable will now contain all national, state, and religious holidays for Norway in the year 2020.
List<Holiday> result = service.getHolidaysForCountry(country, 2020);
Where to go next?
See our GitHub repository for more information on the Java/JVM Library.
# Carthage
github "TimeAndDate/TadApi"
# CocoaPods
pod 'libtad-swift', '~> 1.0'
Build Query
The API library is now installed. Next, you specify the kind of holidays you want to request, the country, and the year. You can find all available countries in our country overview.
To perform the query, you will need your access key and secret key: Get them from the Access Key page on My Account. Don't have a key? Sign up for our free trial and receive an access key to try it out.
let service = HolidaysService(accessKey: accessKey, secretKey: secretKey)
let request = HolidaysRequest()
request.country = "no"
request.year = 2020
request.types = [HolidayTypes.federal, HolidayTypes.federallocal, HolidayTypes.religious]
Get Result
The result
variable will now contain all national, state, and religious holidays for Norway in the year 2020.
service.getHolidays(request: request, completionHandler: { (result, error) in
print(result)
})
Where to go next?
See our GitHub repository for more information on the Swift Library.
$ pip3 install libtad
Build Query
The API library is now installed. Next, you specify the kind of holidays you want to request, the country, and the year. You can find all available countries in our country overview.
To perform the query, you will need your access key and secret key: Get them from the Access Key page on My Account. Don't have a key? Sign up for our free trial and receive an access key to try it out.
from libtad import HolidaysService
from libtad.datatypes.holidays import HolidayType
country = "no"
service = HolidaysService("accessKey", "secretKey")
service.types = HolidayType.Federal | HolidayType.Weekdays
Get Result
The result
variable will now contain all national, state, and religious holidays for Norway in the year 2020.
result = service.holidays_for_country(country, 2020)
Where to go next?
See our GitHub repository for more information on the Python Library.
gem 'libtad'
Build Query
The API library is now installed. Next, you specify the kind of holidays you want to request, the country, and the year. You can find all available countries in our country overview.
To perform the query, you will need your access key and secret key: Get them from the Access Key page on My Account. Don't have a key? Sign up for our free trial and receive an access key to try it out.
types = [:federal, :weekdays]
client = LibTAD::Client.new(access_key: 'access_key', secret_key: 'secret_key')
Get Result
The result
variable will now contain all national, state, and religious holidays for Norway in the year 2020.
result = client.get_holidays(country: 'no', types: types, year: 2020)
Where to go next?
See our GitHub repository for more information on the Ruby Library.
Build Query
You will need cURL installed in order to execute the following commands. The following samples also require you to have enabled "Insecure Methods" on your access key.
$ ACCESSKEY="<Your Access Key>"
$ SECRETKEY="<Your Secret Key>"
$ curl -G \
--data-urlencode "version=3" \
--data-urlencode "prettyprint=1" \
--data-urlencode "accesskey=$ACCESSKEY" \
--data-urlencode "secretkey=$SECRETKEY" \
--data-urlencode "country=ro" \
--data-urlencode "year=2021" \
--data-urlencode "types=federal,federallocal,religious" \
https://api.xmltime.com/holidays
Get results
Execute cURL with the parameters set previously and receive the resulting calculation as a JSON object.
{
"version": 3,
"billing": {
"credits": 1
},
"holidays": [{
"id": 1687,
"urlid": "romania/new-year-day",
"url": "https://www.timeanddate.com/holidays/romania/new-year-day",
"country": {
"id": "ro",
"name": "Romania"
},
"name": [{
"lang": "en",
"text": "New Year's Day"
}],
"oneliner": [{
"lang": "en",
"text": "New Year’s Day (Anul Nou) and the following day, on January 1 and 2 respectively, are annual holidays in Romania."
}],
"types": ["National holiday"],
"subtype": null,
"date": {
"iso": "2021-01-01",
"datetime": {
"year": 2021,
"month": 1,
"day": 1
}
},
"uid": "00069700000007e5"
},{
....
Install Official Libraries
To get started, use one of timeanddate.com's official API libraries for your programming language. If your language isn't supported, you can send the requests manually over HTTP. If you would like to request an official library for your language, please contact us.
$ git clone https://github.com/timeanddate/libtad-net
Build Query
The API library is now installed. Next, you can optionally specify the kind of events you want to request, the month, and the day.
To perform the query, you will need your access key and secret key: Get them from the Access Key page on My Account. Don't have a key? Sign up for our free trial and receive an access key to try it out.
var month = 2;
var day = 25;
var service = new OnThisDayService('accessKey', 'secretKey');
service.Types = EventType.Births | EventType.Deaths;
Get Result
The result
variable will now contain births and deaths occuring on 25th of February.
var result = service.EventsOnThisDay(month, day);
Where to go next?
See our GitHub repository for more information on the C#/.NET Library.
<repository>
<id>github</id>
<name>Time and Date API Packages</name>
<url>https://maven.pkg.github.com/timeanddate/libtad-jvm</url>
</repository>
<dependency>
<groupId>com.timeanddate</groupId>
<artifactId>services</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
Build Query
The API library is now installed. Next, you can optionally specify the kind of events you want to request, the month, and the day.
To perform the query, you will need your access key and secret key: Get them from the Access Key page on My Account. Don't have a key? Sign up for our free trial and receive an access key to try it out.
var month = 2;
var day = 25;
EnumSet<ODTEventType> type = EnumSet.of(OTDEventType.BIRTHS, ODTEventType.DEATHS);
var service = new OnThisDayService('accessKey', 'secretKey');
service.setEventTypes(type);
Get Result
The result
variable will now contain births and deaths occuring on 25th of February.
var result = service.eventsOnThisDay(month, day);
Where to go next?
See our GitHub repository for more information on the Java/JVM Library.
gem 'libtad'
Build Query
The API library is now installed. Next, you can optionally specify the kind of events you want to request, the month, and the day.
To perform the query, you will need your access key and secret key: Get them from the Access Key page on My Account. Don't have a key? Sign up for our free trial and receive an access key to try it out.
types = [:births, :deaths]
client = LibTAD::Client.new(access_key: 'access_key', secret_key: 'secret_key')
Get Result
The births
and deaths
variables will now respectively contain births and deaths occuring on 25th of February.
_events, births, deaths = client.get_events_on_this_day(types: types, month: 2, day: 25)
Where to go next?
See our GitHub repository for more information on the Ruby Library.
Add libtad-rs
as a dependency in Cargo.toml
:
libtad-rs = "0.2"
Build Query
The API library is now installed. Next, you can optionally specify the kind of events you want to request, the month, and the day.
To perform the query, you will need your access key and secret key: Get them from the Access Key page on My Account. Don't have a key? Sign up for our free trial and receive an access key to try it out.
let client = ServiceClient::new("access_key", "secret_key");
let request = OnThisDayRequest::new()
.set_month(2)
.set_day(25)
.with_type(EventType::Births)
.with_type(EventType::Deaths);
Get Result
The result
variable will now contain births and deaths occuring on 25th of February.
let result = client.get_events_on_this_day(&request);
Where to go next?
See our GitHub repository for more information on the Rust Library.
Build Query
You will need cURL installed in order to execute the following commands. The following samples also require you to have enabled "Insecure Methods" on your access key.
$ ACCESSKEY="<Your Access Key>"
$ SECRETKEY="<Your Secret Key>"
$ curl -G \
--data-urlencode "version=3" \
--data-urlencode "prettyprint=1" \
--data-urlencode "accesskey=$ACCESSKEY" \
--data-urlencode "secretkey=$SECRETKEY" \
--data-urlencode "types=events" \
--data-urlencode "month=2" \
--data-urlencode "day=25" \
https://api.xmltime.com/onthisday
Get Result
Execute cURL with the parameters set previously and receive the resulting calculation as a JSON object.
{
"version": 3,
"billing": {
"credits": 1
},
"events": [{
"id": 717,
"name": [{
"lang": "en",
"text": "Corazon Aquino is sworn in as the 11th President of the Philippines"
}],
"date": {
"iso": "1986-02-25",
"datetime": {
"year": 1986,
"month": 2,
"day": 25
}
},
"location": null,
"categories": ["Current Events/ Politics/ National"],
"countries": [{
"id": "ph",
"name": "Philippines"
}],
"description": [{
"lang": "en",
"text": "Aquino's presidency ended 20 years of dictatorship. She was the first female president in Asia."
}]
},{
"id": 715,
"name": [{
"lang": "en",
"text": "The state of Prussia is dissolved"
}],
"date": {
"iso": "1947-02-25",
"datetime": {
"year": 1947,
"month": 2,
"day": 25
}
},
"location": null,
"categories": ["Current Events/ Politics/ Regional"],
"countries": [{
"id": "de",
"name": "Germany"
}],
"description": [{
"lang": "en",
"text": "At its peak, the most important state of the German empire encompassed parts of modern-day Germany, Poland, and Russia."
}]
},{
"id": 716,
"name": [{
"lang": "en",
"text": "Muhammad Ali becomes world heavyweight champion"
}],
"date": {
"iso": "1964-02-25",
"datetime": {
"year": 1964,
"month": 2,
"day": 25
}
},
"location": "Miami",
"categories": ["Entertainment/ Sports"],
"countries": [{
"id": "us",
"name": "United States"
}],
"description": [{
"lang": "en",
"text": "Ali, who still used his original name Cassius Clay at the time, is considered one of the greatest heavyweight boxers in history."
}]
},{
"id": 718,
"name": [{
"lang": "en",
"text": "The Warsaw Pact is declared disbanded"
}],
"date": {
"iso": "1991-02-25",
"datetime": {
"year": 1991,
"month": 2,
"day": 25
}
},
"location": "Budapest",
"categories": ["Current Events/ Politics/ International"],
"countries": [{
"id": "ru",
"name": "Russia"
},{
"id": "al",
"name": "Albania"
},{
"id": "bg",
"name": "Bulgaria"
},{
"id": "de",
"name": "Germany"
},{
"id": "pl",
"name": "Poland"
},{
"id": "ro",
"name": "Romania"
},{
"id": "cz",
"name": "Czechia"
},{
"id": "sk",
"name": "Slovakia"
},{
"id": "hu",
"name": "Hungary"
}],
"description": [{
"lang": "en",
"text": "Following the end of the Cold War, the defense treaty between 8 communist states had lost its purpose. It had been signed in 1955 as an antagonist of NATO."
}]
},{
"id": 719,
"name": [{
"lang": "en",
"text": "An Israeli doctor kills 30 unarmed Palestinians in the Mosque of Abraham"
}],
"date": {
"iso": "1994-02-25",
"datetime": {
"year": 1994,
"month": 2,
"day": 25
}
},
"location": "Hebron",
"categories": ["Current Events/ Terrorist Attacks",
"Current Events/ War"],
"countries": [{
"id": "il",
"name": "Israel"
},{
"id": "ps",
"name": "Palestinian Territories"
}],
"description": [{
"lang": "en",
"text": "The massacre by right-wing extremist Baruch Goldstein was widely condemned, also in Israel."
}]
}]
}