Date strings

Query date strings for a Supermetrics API query can be provided either as fixed dates, or as a relative dates.

Supported formats

Fixed date

Fixed date should always be in the format of YYYY-MM-DD.

Unix timestamp

Unix timestamp is the number of seconds since Jan 1st 1970 UTC. When using a unix timestamp, it should be prefixed with an at-sign. Only UTC date precision is used and time of day is ignored.

Relative date

Relative date is a human-friendly string that can be translated into a date. They are treated as an offset from the current time. Relative dates use keywords written in English.

{"start_date":"previous Monday"}


Example 1

Date range from a fixed date into yesterday.

{"start_date":"2019-01-01", "end_date":"yesterday"}
Example 2

Start date is 2 weeks ago and moves with the current day.

{"start_date":"-2 weeks", "end_date":"today"}
Example 3

Start date is not just moving but also a specific week day.

{"start_date":"-2 weeks next Monday", "end_date":"today"}
Example 4

Date range from a unix timestamp into yesterday.

{"start_date":"@1577836800", "end_date":"yesterday"}


A good set of relative date formatting rules and examples are available in the PHP language documentation.

Last updated 2022-03-02 UTC.