datetime format for API

nalberto8 years ago

Hi Anton,

I am trying to use the api to retrieve routes from a device.

What is the datetime format that needs to be provided to the from and to parameters.

/api/reports/route?deviceId=1&from=XXXXXX&to=XXXXXXX

Would you also have an example? That would be great.

Thanks again

Anton Tananaev8 years ago

ISO time format is expected. Here is an example:

/api/reports/route?deviceId=375&from=2016-10-31T04%3A19%3A44.000Z&to=2016-10-31T04%3A49%3A44.000Z

Hello, as always my respects and admiration for Anton, precisely about this issue, I have noticed that in Traccar when selecting any report, when selecting a specific date and time, Traccar sends that date / time to the API adding 5 more hours. Example: When selecting: 2021-09-26 19:00:00, when observing the API call, it actually sends: 2021-09-27 00:00:00, that is, it adds 5 hours, could someone explain to me why does, what is the justification and how should I calculate if it is 5 hours or less or more?

Sorry to ask questions without first bothering to do some research. I answer myself: 5 hours are added because for the local time of my country, that is the difference between local time and UTC time.

Anton Tananaev3 years ago

Traccar uses full time, including time zone, so you should be able to figure out any local time based on that information.