Timezone
The Timezone endpoint provides the UTC offset for each day in a requested range. Use this to convert UTC timestamps in timeseries and event data to the user's local time.
GET /v1/timeline/events/timezones/{user_id}
Parameters
| Name | Type | In | Description |
|---|---|---|---|
user_id |
UUID | Path | The unique identifier for the user. |
start_date |
Date | Query | The start date for the query period (format: YYYY-MM-DD). |
end_date |
Date | Query | The end date for the query period (format: YYYY-MM-DD). |
Response Formats
| Header Value | Format |
|---|---|
application/json |
JSON (default) |
text/csv |
CSV |
Responses
200 OK
[
{
"date": "2024-04-01",
"timezone": {
"offset_minutes": 120,
"found_date": "2024-04-01"
}
},
{
"date": "2024-04-02",
"timezone": {
"offset_minutes": 120,
"found_date": "2024-04-02"
}
}
]
Example Request (JSON)
cURL
curl -X GET "https://research-api.nowatch.com/v1/timeline/events/timezones/YOUR_USER_ID?start_date=2024-04-01&end_date=2024-04-07" \
-H "accept: application/json" \
-H "X-API-KEY: YOUR_API_KEY"
Example Request (CSV)
cURL
curl -X GET "https://research-api.nowatch.com/v1/timeline/events/timezones/YOUR_USER_ID?start_date=2024-04-01&end_date=2024-04-07" \
-H "accept: text/csv" \
-H "X-API-KEY: YOUR_API_KEY"
Applying timezones
To convert UTC timestamps to local time, look up the offset_minutes for the date of each sample and add that offset.
A positive offset_minutes (e.g. 120) means UTC+02:00; a negative value means west of UTC.