Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Confusion regarding Intraday data date time construction

I am fetching intraday steps count for our application. I am confused about how intra day times are being constructed. The api result consists of date and intra day time. Lets say the date is "yyyy-mm-dd" and time is "09:15:00", in that case should I assume that the timestamp "yyyy-mm-dd 09:15:00" constructed from current device timezone? If I change the device timezone after the recorded steps count, will the timestamp shift or remain same as "yyyy-mm-dd 09:15:00".

 

Best Answer
0 Votes
4 REPLIES 4

Typically, API timestamps are provided in Coordinated Universal Time (UTC) to maintain consistency across different timezones. However, the specifics may vary based on the API you're using. If the API you're using provides timestamps in UTC, then the timestamp wouldn't shift even if you change the device timezone. It would remain as "yyyy-mm-dd 09:15:00". If the API is using device timezone, changing the timezone could potentially affect the timestamps. I would recommend checking the API documentation or contacting the API provider to clarify how they handle timestamps. This way, you can ensure accurate data handling in your application.

Best Answer
0 Votes

I am using these two APIs; one for steps intraday data https://dev.fitbit.com/build/reference/web-api/intraday/get-activity-intraday-by-date/  another one is heart rate intraday data https://dev.fitbit.com/build/reference/web-api/intraday/get-heartrate-intraday-by-date/ . My main confusion regarding timezones are for these APIs. In the API documentation of Fitbit, we can see that "Users can specify a time zone in their settings, but this offset is only used to determine the start of their 24-hour period." So, does it apply for intraday api request?   

Best Answer
0 Votes

Hi @diptopol,

All date and time related fields in the API requests and responses are rendered in the local time of the resource owner's timezone (either the authorized user or the owner of the resource requested).

Some endpoints such as activity and heart rate support the query parameter “timezone=UTC” for returning the data at UTC instead of the user’s timezone settings. Please see the specific endpoints to know if it supports the “timezone” query parameter.

The endpoints you referenced both support the "timezone=UTC" query parameter, and will return the detail-level in UTC format instead of the user's local time.

I hope this helps. Let me know if you have any additional questions.

 

 

Best Answer
0 Votes

Hi @JohnFitbit 

I have couple of additional questions. First, we rely upon notification to fetch intra day data using the API. I am also assuming the date in the notification itself based on local time of the resource owner's timezone and that's the reason we don't fetch data for UTC timezone. Please let me know whether my assumption is correct.

The second part is that, I have conducted a small experiment where I have changed the device timezone from (GMT -04:00) to timezone (GMT +06:00), collected few data, and moved to back timezone GMT -04:00. In that experiment I have seen that data collected during that period with timezone (GMT +06:00) is not visible later and I am getting 0 steps for that period. Please let me know whether it is a bug or intended behavior.

  

Best Answer
0 Votes