Businessdate

The businessdate service can be used to find a business date from a specified number of days.

You can choose if you want to calculate the business date by adding (default) or subtracting the given days, and whether or not a specific filter should be applied to the result. By default the result will be filtered on excluding weekends and public holidays, but you can specify a custom filter to modify this.

This service can be tested with the Query Builder.

Request Parameters:

NameDescriptionRequired
placeid

Specify the ID of the location you would like to calculate the business date. The ID is used to find what holidays are applicable for the given place so the calculation can exclude or include those results.

Note: It is also possible to specify coordinates or IATA/ICAO codes for airports, see the documentation for the type Location Id for detailed information.

Type: String / Location Id

Condition: either the placeid or the country parameter has to be specified.

Conditional
country

Specify the country for which you would like to calculate the business date.

Type: String / ISO3166-1-alpha-2 country code

Condition: either the placeid or the country parameter has to be specified.

Conditional
state

Specify the state in the given country you want to calculate the business date.

Type: String / ISO3166-2 country state code

Condition: only if the country parameter has been specified.

Conditional
startdt

Specify the ISO 8601 date for the first date you are interested in.

Type: String / ISO8601 Date

Yes
days

Specify how many business days to count.

Note: The parameter will be sorted in ascending order (e.g. if the values 30,20,10 is passed it will be sorted to 10,20,30). There is a limit of maximum 10 values per requests.

Type: Integer / Array of integers

Example: 10, 20

Yes
include

Specify whether the result should be calculated by including instead of excluding the days.

Type: Boolean

Default value: 0

No
filter

Choose a set of types or days you want to filter on.

Type: String / Array of Business Days Filter Type

Default value: weekendholidays

No
op

Set if the service should do an addition or subtraction of the specified days.

Type: String / Business Days Operator Type

Default value: add

No
repeat

Set how many times the calculation should be repeated (only applicable when days parameter has exactly one number).

Type: Integer

No
calendar

List all dates in the requested period with a flag indicating if the date was excluded and/or if the date is a holiday.

Type: Boolean

Default value: 0

No
lang

The preferred language for the texts. An error will be raised if the language code cannot be recognized. In case the text for a specific event cannot be retrieved in the requested language it will be returned in English instead. This is also the default language.

In case you have specific needs for a certain language/translation, please contact us.

Type: String / ISO639 Language Code

Default value: en

No
verbosetime

Adds verbose time specification to all ISO 8601 time stamps.

Type: Boolean

Accepted values: 0 or 1

Default value: 1

No

See also the section “General Parameters”.

Response Elements:

NameDescription
geo

Geographical information about the location.

Type: GeoType

period (XML), periods (JSON)

This array will contain the calculated result for the requested period. For the XML format, it will be repeated multiple times, while for JSON, it is modeled as an array of objects with the same content.

Type: Array of PeriodType

Example JSON Request:

https://api.xmltime.com/businessdate?placeid=190&startdt=2015-04-01&days=18&version=3&out=json&prettyprint=1&accesskey={KEY}&expires={TIMESTAMP}&signature={SIGNATURE}

Example JSON response:


{
  "version": 3,
  "billing": {
    "credits": 1
  },
  "geo": {
    "latitude": -0.220000,
    "longitude": -78.511948,
    "name": "Quito",
    "country": {
      "id": "ec",
      "name": "Ecuador"
    },
    "state": ""
  },
  "periods": [{
    "includeddays": 18,
    "calendardays": 27,
    "skippeddays": 9,
    "startdate": {
      "iso": "2015-04-01",
      "datetime": {
        "year": 2015,
        "month": 4,
        "day": 1
      }
    },
    "enddate": {
      "iso": "2015-04-28",
      "datetime": {
        "year": 2015,
        "month": 4,
        "day": 28
      }
    },
    "weekdays": {
      "type": "excluded",
      "count": 8,
      "mon": 0,
      "tue": 0,
      "wed": 0,
      "thu": 0,
      "fri": 0,
      "sat": 4,
      "sun": 4
    },
    "holidays": {
      "type": "excluded",
      "count": 1,
      "list": [{
        "id": 984,
        "urlid": "ecuador/good-friday",
        "uid": "0003d800000007df",
        "url": "https://www.timeanddate.com/holidays/ecuador/good-friday",
        "name": [{
          "lang": "en",
          "text": "Good Friday"
        },{
          "lang": "es",
          "text": "Viernes Santo"
        },{
          "lang": "de",
          "text": "Karfreitag"
        }],
        "date": {
          "iso": "2015-04-03",
          "datetime": {
            "year": 2015,
            "month": 4,
            "day": 3
          }
        }
      }]
    }
  }]
}

Example XML Request:

https://api.xmltime.com/businessdate?placeid=190&startdt=2015-04-01&days=18&version=3&out=xml&prettyprint=1&accesskey={KEY}&expires={TIMESTAMP}&signature={SIGNATURE}

Example XML response


<data version="3">
  <billing>
    <credits>1</credits>
  </billing>
  <geo>
    <latitude>-0.220000</latitude>
    <longitude>-78.511948</longitude>
    <name>Quito</name>
    <country id="ec">Ecuador</country>
    <state></state>
  </geo>
  <period includeddays="18" calendardays="27" skippeddays="9">
    <startdate iso="2015-04-01">
      <datetime>
        <year>2015</year>
        <month>4</month>
        <day>1</day>
      </datetime>
    </startdate>
    <enddate iso="2015-04-28">
      <datetime>
        <year>2015</year>
        <month>4</month>
        <day>28</day>
      </datetime>
    </enddate>
    <weekdays type="excluded" count="8">
      <mon>0</mon>
      <tue>0</tue>
      <wed>0</wed>
      <thu>0</thu>
      <fri>0</fri>
      <sat>4</sat>
      <sun>4</sun>
    </weekdays>
    <holidays type="excluded" count="1">
      <list>
        <holiday id="984" urlid="ecuador/good-friday" uid="0003d800000007df" url="https://www.timeanddate.com/holidays/ecuador/good-friday">
          <name>
            <text lang="en">Good Friday</text>
            <text lang="es">Viernes Santo</text>
            <text lang="de">Karfreitag</text>
          </name>
          <date iso="2015-04-03">
            <datetime>
              <year>2015</year>
              <month>4</month>
              <day>3</day>
            </datetime>
          </date>
        </holiday>
      </list>
    </holidays>
  </period>
</data>