API: How to set date/time parameters
The Parse.ly API allows for both fixed and relative time inputs to query data. Learn more about the metrics that you can pair with date/time values in queries.
Fixed Time
Parse.ly allows for a variety of fixed time formats.
Format | Description |
---|---|
YYYY-MM-DD | Year-Month-Day. Example: 2012-01-02 for January 2nd, 2012. This defaults to your publisher timezone in the dashboard, and is considered end of day (23:59) for end time parameters. |
YYYY-MM-DD±00:00 | Year-Month-Day with timezone offset. Example: 2012-01-02-05:00 for January 2nd, 2012 EST. This is assumed to be 23:59 in the specified timezone for end time parameters. |
YYYY-MM-DDThh:mm | Year-Month-Day with time in publisher timezone. Example: 2012-01-02T07:30 for January 2nd, 2012 7:30 am. |
YYYY-MM-DDThh:mm±00:00 | Year-Month-Day with time and timezone. Example: 2012-01-02T07:30+00:00 for January 2nd, 2012 7:30 am UTC. |
All values need to be appropriately URL-encoded when submitted, or you may receive an error. Notably, the +
sign in positive timezone offsets will need to be converted to %2B
, either your HTTP request library or manually, otherwise it will be interpreted as a space.
Timezone offsets in string form, e.g. Eastern
, EST
or UTC
, are not allowed.
Relative Time
Parse.ly also allows for relative time formats.
Relative times are a number followed by m
, h
, d
, w
for minutes, hours, days, and weeks, respectively.
Examples: 15m
for 15 minutes ago, 24h
for 24 hours ago.
Formats like 15min
, 15 min
or 15minutes
should not be used.
Last updated: October 28, 2024