Hichem_Agrebi | 2021-03-12 15:21:42 UTC | #1
I need a confirmation of the startTime and endTime in the AWFM Adherence API, since we are required to supply the timeZone, my understanding that the 2 date time fields need to be in the indicated timezone or does it need to be in UTC? The documentation seems to only indicate that the dates needs to be in ISO-8601 format.
POST/api/v2/workforcemanagement/adherence/historical { "startDate": "2021-03-10T08:00:00Z", <- what time zone this this be in? "endDate": "2021-03-10T10:00:00Z", <- what time zone this this be in? "timeZone": "Europe/Paris", "userIds": ["d60ff553-263f-4179-87b9-49130fe4cce8"], "includeExceptions": false }
Much appreciated Thanks
brian.trezise | 2021-03-12 15:59:17 UTC | #2
Hi, thanks for reaching out.
To answer your question, the start and end dates can be whatever timezone you want, as ISO-8601 allows you to specify your offset from UTC directly in the passed value. Passing in values other than UTC is not recommended however as it will introduce ambiguity around DST/daylight savings time transitions. The example you posted ends with Z which means it's in UTC.
The timeZone field is used to define "days" in the response.
Ideally, regardless of the time zone you pass in the start and end date you should pass a time corresponding to midnight in the requested timeZone as otherwise your response will contain some data for partial days at the start and end of the range.
Hichem_Agrebi | 2021-03-12 16:14:39 UTC | #3
Thanks Brian, I actually have done a test and it seems to confirm that the time can only be indicated in UTC. When I run the above query with Paris date time, I get "message": "Field 'endDate' must be a DateTime in the past. Future values are not valid",. So this seems to prove that it needs to be UTC instead of the time in the indicated timezone. Do you agree?
The API call was with these arguments (my TZ is Paris) shortly after 17:00 paris time. So it did interpret the 17:00 as UTC instead of Paris time hence it returned the error about not being valid as in the future { "startDate": "2021-03-12T16:00:00Z", "endDate": "2021-03-12T17:00:00Z", "timeZone": "Europe/Paris", "userIds": ["d60ff553-263f-4179-87b9-49130fe4cce8"], "includeExceptions": false }
brian.trezise | 2021-03-12 16:28:35 UTC | #4
The time zone in the "timeZone" field is not related to the offset you pass in the start/end date. When you pass "2021-03-12T17:00:00Z" the Z tells the software to interpret the date as UTC (or "zulu").
As mentioned in my initial response, we don't actually recommend passing these values in non-UTC offsets, but if you want to do so using the offset for Paris, the above time stamp would be "2021-03-12T18:00:00+01:00" (note the offset at the end of the string is "+01:00" instead of "Z")
The timeZone field is only used for organizing the results in the response into "local" days
system | 2021-04-12 16:27:55 UTC | #5
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 10261