Timestamps
The HTTP API uses RFC3339 timestamps both in different JSON objects and in query parameters. Most programming languages have built-in support or a library available for both formatting and parsing a RFC3339 timestamp.
The HTTP API currently normalizes timestamps to UTC in its output.
Example RFC3339 timestamps
1985-04-12T23:20:50.52Z
1990-12-31T15:59:60-08:00
2018-02-17T04:19:03.636Z
JSON
In JSON objects the timestamps is represented by a string with the formatted RFC3339 timestamp.
Query support - single
Exact date
Exact dates are supported both in RFC3339 format and in a more lenient format which takes the date in ISO8601 format with optional hours and minutes.
Examples of lenient format:
2018-02-10
- will be treated as 00:00 UTC on the given date2017-01-01 10:00
- will be treated as 10:00 UTC on the given date
Use in a query criteria:
{
"type": "propertyHere",
"criteria": "2017-01-01 10:00"
}
Relative dates
In addition to exact dates a few relative dates are supported for simpler queries:
none
- no date should be availableany
- any date should be availabletoday
- todays date at 00:00 UTCtomorrow
- tomorrows date at 00:00 UTCclosing-today
- today before Contentor "closing time", currently 18:00 UTCstart-of-week
- the start of the current week at 00:00 UTCend-of-week
- the end of the current week at 00:00 UTC
Query support - ranges
When timestamps are used in queries they can be queried exactly or as a range.
Simple range
Some simple ranges that consist of a single string are available when querying:
{
"type": "propertyHere",
"criteria": "this-week"
}
The following ranges are supported and match using UTC:
none
- no dates considered within the rangepast
- only dates before now will matchedprevious-month
- match the previous monthprevious-week
- match the previous weekyesterday
- match yesterdaytoday
- match todaytomorrow
- match tomorrowthis-week
- match this week, from Monday to Sundaynext-week
- match next week, from Monday to Sundaythis-month
- match the current monthnext-month
- match the next monththis-year
- match the current yearfuture
- match only dates in the future
Manual range
Exact dates and relative dates can be combined into a range using a JSON object
with from
and to
properties. One of the properties need to be specified,
but if the other is skipped it is treated as an open range.
The from
and to
properties can be any exact or relative date.
Open range which matches up to today:
{
"type": "propertyHere",
"criteria": {
"to": "today"
}
}
Open range which matches from today:
{
"type": "propertyHere",
"criteria": {
"from": "today"
}
}
Open range which matches between two days:
{
"type": "propertyHere",
"criteria": {
"from": "2017-01-01",
"to": "2018-01-01"
}
}