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

# Timestamps and Time Zones

> Learn about Junction timestamp conventions including UTC-based ISO 8601 formatting and floating time handling for specific device types.

## Timestamps

All Junction data timestamps are ISO 8601 formatted as follows:

| Providers                                                 | Time Basis                    | Pattern                                                                                           |
| --------------------------------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------- |
| `abbott_libreview`<br />`freestyle_libre` <sup>\[1]</sup> | Floating Time <sup>\[2]</sup> | `YYYY-mm-ddTHH:mm:ss+00:00`<br />The `+00:00` TZ specifier should be **ignored** <sup>\[3]</sup>. |
| *Everyone else*                                           | UTC                           | `YYYY-mm-ddTHH:mm:ss+00:00`<br />Always specified as `+00:00` (UTC).                              |

<Info>
  <sup>\[1]</sup>
  `freestyle_libre` specific:
  Some older teams may see floating time data (Freestyle Libre) without the `+00:00` TZ specifier,
  as part of an earlier iteration of the feature. Contact Junction support if you wish to disable this
  behavior, or if you intend to adopt the Junction backend SDKs.
</Info>

<Info>
  <sup>\[2]</sup> [Floating time](https://www.w3.org/International/wiki/FloatingTime) is not affixed to any time zone.
  This is not the same as time relative to a local time zone, i.e., a known UTC offset or geographical location.
</Info>

<Warning>
  <sup>\[3]</sup> Junction sends timestamps in floating time with `+00:00` for OpenAPI 3.x interoperability. OAS 3
  requires all timestamps to be [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339), which in turn requires
  a TZ specifier to be mandatory.

  When processing data from Freestyle Libre, you should [**reinterpret literally**](#data-point-in-floating-time-abbott-libreview--freestyle-libre)
  the date and time components as local date-time in the desired time zone. Do not convert from UTC/Zulu.
</Warning>

## Time Zones

Junction formats time zones in data as a *nullable* integer offset to UTC:

* A positive offset indicates east of UTC.
* A negative offset indicates west of UTC.
* `null` indicates the time zone information is absent.

Each provider has their own affinity of time zone information:

| Affinity                 | Time Basis    | Time Zone                                                                                                                                            |
| ------------------------ | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| ✅                        | UTC           | The data comes with time zone information.                                                                                                           |
| User Fallback, or UTC    | UTC           | We assume the data were captured in the [User Fallback Time Zone](#user-fallback-time-zone). We fall back to UTC if the former is not set.           |
| User Fallback, or Absent | UTC           | We assume the data were captured in the [User Fallback Time Zone](#user-fallback-time-zone). Mark as no time zone (`null`) if the former is not set. |
| Inferred, or Absent      | UTC           | We infer the time zone from the data. Mark as no time zone (`null`) if the inference fails.                                                          |
| Absent                   | UTC           | We do not know the exact time zone the recording took place in. Mark as no time zone (`null`).                                                       |
| Floating Time            | Floating Time | We do not know the exact time zone the recording took place in. Mark as no time zone (`null`).                                                       |

### Cloud-based Providers

| Provider                                                                     | Activity Summary (Daily) | Session Summary (e.g., Sleep) | Timeseries Sample   | Remarks                                                        |
| ---------------------------------------------------------------------------- | ------------------------ | ----------------------------- | ------------------- | -------------------------------------------------------------- |
| [Freestyle Libre](https://www.freestylelibre.co.uk/libre/) `freestyle_libre` | *N/A*                    | *N/A*                         | Floating Time       |                                                                |
| [Abbott LibreView](https://www.libreview.com/) `abbott_libreview`            | *N/A*                    | *N/A*                         | Floating Time       |                                                                |
| [Fitbit](https://www.fitbit.com/global/uk/home)          `fitbit`            | ✅                        | ✅                             | ✅                   | ⚠️ [Time Zones](/wearables/guides/fitbit#time-zone-resolution) |
| [Garmin](https://www.garmin.com)                         `garmin`            | ✅                        | ✅                             | ✅                   |                                                                |
| [Google Fit](https://www.google.com/fit/)                `google_fit`        | User Fallback, or UTC    | User Fallback, or Absent      | Absent              |                                                                |
| [Oura](https://ouraring.com)                             `oura`              | ✅                        | ✅                             | ✅                   |                                                                |
| [Peloton](https://www.onepeloton.com)                    `peloton`           | *N/A*                    | ✅                             | *N/A*               |                                                                |
| [Strava](https://www.strava.com)                         `strava`            | *N/A*                    | ✅                             | ✅                   |                                                                |
| [Wahoo](https://wahoofitness.com)                        `wahoo`             | *N/A*                    | Absent                        | *N/A*               |                                                                |
| [WHOOP](https://www.whoop.com)                           `whoop_v2`          | ✅                        | ✅                             | *N/A*               |                                                                |
| [Zwift](https://zwift.com)                               `zwift`             | *N/A*                    | User Fallback, or Absent      | *N/A*               |                                                                |
| [Withings](https://www.withings.com)                     `withings`          | ✅                        | ✅                             | ✅                   |                                                                |
| [8Sleep](https://www.eightsleep.com)                     `eight_sleep`       | *N/A*                    | ✅                             | ✅                   |                                                                |
| [Hammerhead](https://www.hammerhead.io)                  `hammerhead`        | *N/A*                    | Inferred, or Absent           | Inferred, or Absent |                                                                |
| [Dexcom](https://www.dexcom.com)                         `dexcom_v3`         | *N/A*                    | *N/A*                         | ✅                   |                                                                |
| [Polar](https://www.polar.com)                           `polar`             | ✅                        | ✅                             | ✅                   |                                                                |
| [Kardia](https://kardia.com/)                            `kardia`            | *N/A*                    | *N/A*                         | ✅                   |                                                                |
| [Omron](https://www.omron-healthcare.com)                `omron`             | ✅                        | *N/A*                         | ✅                   |                                                                |

### SDK-based Providers

<Info>
  On-device data often do not capture the time zone at recording time.
  Junction SDK uses the device's current time zone as the closest approximation.
</Info>

| Provider                                                                                            | Activity Summary (Daily) | Session Summary | Timeseries Samples |
| --------------------------------------------------------------------------------------------------- | ------------------------ | --------------- | ------------------ |
| [Apple HealthKit](https://www.apple.com/uk/ios/health/)                       `apple_health_kit`    | ✅                        | ✅               | ✅                  |
| [Android Health Connect](https://developer.android.com/health-connect)        `health_connect`      | ✅                        | ✅               | ✅                  |
| [Omron](https://www.omron-healthcare.com)                                     `omron_ble`           | *N/A*                    | *N/A*           | ✅                  |
| [Contour](https://www.diabetes.ascensia.com)                                  `contour_ble`         | *N/A*                    | *N/A*           | ✅                  |
| [Accu-Chek](https://www.accu-chek.com)                                        `accuchek_ble`        | *N/A*                    | *N/A*           | ✅                  |
| [Freestyle Libre BLE](https://www.freestylelibre.co.uk/libre/)                `freestyle_libre_ble` | *N/A*                    | *N/A*           | ✅                  |

## Examples

### Data point with time zone offset

The data point was recorded on July 7, 2023 at 1:00 PM in UTC-07:00.

```json theme={null}
{
  "source": {
    "provider": "apple_health_kit",
  },
  "data": [
    {
      "timestamp": "2023-07-07T20:00:00+00:00",
      "timezone_offset": -25200
    }
  ]
}
```

### Data point with no time zone offset (`null`)

The data point was timestamped to Aug 13, 2023 at 8:12 AM in UTC+00:00 (Zulu).
We do not know the exact time zone the recording took place in.

```json theme={null}
{
  "source": {
    "provider": "apple_health_kit",
  },
  "data": [
    {
      "timestamp": "2023-08-13T08:12:00+00:00",
      "timezone_offset": null
    }
  ]
}
```

### Data point in floating time (Abbott LibreView & Freestyle Libre)

This Freestyle Libre data point was recorded on Sep 27, 2023 at 7:48 AM in floating time
(whichever time zone the user was in). We do not know the exact time zone the recording took place in.

You can display the date and time components literally to the user, e.g., `2023/09/27 07:48 AM`, as they
are relative to their perception of local time.

If you need to convert it to UTC for persistence, you need to pick a time zone based on your understanding
of the user. Then you should reinterpret the date and time components **literally** in said time zone.

For example, we knew that this example user is based in `America/New_York`. So we would interpret this data
point to be in `2023/09/27 07:48 AM ET`. We then finally convert this to UTC, resulting in `2023/09/27 11:48 AM UTC`.

```json theme={null}
{
  "source": {
    "provider": "freestyle_libre",
  },
  "data": [
    {
      "timestamp": "2023-09-27T07:48:00+00:00",
      "timezone_offset": null
    }
  ]
}
```

## User Fallback Time Zone

Some providers neither expose nor even capture time zone information at source. So Junction can only request data and interpret them strictly in UTC.

If you prefer the data to be contextualized to the geographical location of a user, a Fallback Time Zone (denoted by an [IANA tz database identifier](https://data.iana.org/time-zones/tz-link.html))
can be specified on a per-user basis. Once specified, Junction would use the time zone to pull data and interpret timestamps from any time-zone-unaware providers from that point onwards.

You can specify the Fallback Time Zone when:

* [Creating a new user](/api-reference/user/create-user); or
* [Patching an existing user](/api-reference/user/patch-user)

You will also get information about the source (by slug) and the last updated time of the Fallback Time Zone [when getting an existing user](/api-reference/user/get-user). Fallback Time Zone manually supplied via the REST API would always have a source slug of `manual`.

```jsonc Example theme={null}
{
  "user_id": "409d9870-21fb-443a-8daa-c5222659f40e",
  "team_id": "3aac677c-557f-40b7-9251-0315c1f48e77",
  "client_user_id": "d734e32e-dd43-4b77-ab56-692524279531",
  /** snipped **/
  "fallback_time_zone": {
    "id": "Europe/London",
    "source_slug": "manual",
    "updated_at": "2022-09-11T13:45:56+00:00"
  }
}
```
