Sometimes when requesting historical weather data via the weather API we wish to request data for a fixed period based on the current data. For example, request the data for yesterday or today.
The time period parameter of the weather API allows you to easily request data for dynamic time periods.
Here is an example of using the period parameter in a request:
The period parameter is a replacement for the startDateTime and endDateTime parameters – the system calculates the values for those parameters for you. When a period is specified, it is not possible to specify the startDateTime and endDateTime in the same query.
The period is applicable to any request aggregation level including daily, hourly and sub-hourly requests. Note that the time period names are case sensitive and must be specified in lower case.
Just as with the startDateTime and endDateTime parameters, the dynamic start and end date times are used based on the local time of the locations being queried.
Available time periods
The API currently supports the following time periods.
today – from midnight to the current time at the requested location.
yesterday – from midnight to midnight on yesterday’s date.
yeartodate – from midnight of January 1st of the current year until the current date time.
monthtodate– from midnight on the 1st of the current month until the current date time.
last7days – the seven day period ending on yesterday’s date.
Need more dynamic periods?
Please contact us to request additional dynamic date time periods.