HomeGuidesSamplesAPI
API

Date/Time Format

Includes date/time formats supported in SafetyCulture

Format date/time

Several SafetyCulture APIs require passing a date/time in the request parameters or the request body.

We accept a subset of the Internet Date-Time Format defined in https://www.ietf.org/rfc/rfc3339.txt

Supported range

0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z

Encode JSON format

We recommend using the following pattern:

{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z

Where:

  • {year} is expressed using four digits.
  • {month} / {day} / {hour} / {min}, and {sec} are expressed using two digits (zero-padded).
  • {frac_sec} is the fractional seconds that can include up to nine digits. This is optional.
  • Z is the Z suffix that indicates the timezone (UTC).

The following Internet Date-Time formats are accepted

  • 1990-12-31T23:59:59Z
  • 1985-04-12T23:20:50.52Z
  • 2022-02-16T23:29:41.979Z
  • 2024-03-15T02:22:20.6546022Z
  • 1996-12-19T16:39:57-08:00
  • 2024-03-07T13:45:39-07:00
  • 2024-04-03T09:13:11+11:00
  • 2024-03-15T03:08:51.704820+00:00

The following Internet Date-Time formats are not accepted

  • 2024-03-15T03:20:06
  • 2024-03-08T11:08:14.722+0800

CURL GET request example

When including date/time in a URL query parameter, it must be URL-ENCODED similar to the following example:

curl --location 'https://api.safetyculture.io/tasks/v1/feed/issue_timeline_items?modified_after=2023-04-05T01%3A04%3A33.000Z' \
--header 'Authorization: Bearer {api_token}'

CURL POST request example

curl --location 'https://api.safetyculture.io/schedules/v1/schedule_items' \
--header 'Authorization: Bearer {api_token}' \
--header 'Content-Type: application/json' \
--data '{
	"document": {
		"type": "TEMPLATE",
		"id": "{REDACTED}"
	},
	"assignees": [{
		"id": "{REDACTED}",
		"type": "USER"
	}],
	"from_date": "2023-04-24T11:00:00Z",
	"to_date": "2023-04-24T11:00:00Z",
	"timezone": "EDT",
	"duration": "PT2H",
	"recurrence": "FREQ=YEARLY;BYMONTH=4;BYMONTHDAY=08",
    "description": "TEST",
    "start_time": {
        "hour": 2,
        "minute": 30
    },
    "must_complete": "ONE"

}'