---
title: "Date strings"
slug: "date-strings"
updated: 2025-09-15T16:50:44Z
published: 2025-09-15T16:50:44Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.supermetrics.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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`.

```plaintext
{"start_date":"2020-04-01"}
```

### 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.

```plaintext
{"start_date":"@1585755000"}
```

### 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.

```plaintext
{"start_date":"previous Monday"}
```

## Examples

### Example 1

Date range from a fixed date into yesterday.

```plaintext
{"start_date":"2019-01-01", "end_date":"yesterday"}
```

### Example 2

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

```plaintext
{"start_date":"-2 weeks", "end_date":"today"}
```

### Example 3

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

```plaintext
{"start_date":"-2 weeks next Monday", "end_date":"today"}
```

### Example 4

Date range from a unix timestamp into yesterday.

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

## Resources

A good set of relative date formatting rules and examples are available in the [PHP language documentation](https://www.php.net/manual/en/datetime.formats.php#datetime.formats.relative).
