Set your time zone

We'll teach you how to personalize your request. The first thing on the to-do list is to display different time zones. After all, having the data displayed in your preferred time zone would be pretty convenient, right?

Setting your time zone

All of our dates and times are displayed in UTC by default. However, most applications indicate the times in their relevant time zones, such as CEST and PST.

You wouldn’t want to frustrate your clients by sending them the times of matches in the central European time zone when they live in Australia, now would you?

That’s why we’ve made it easy for you to get all the dates and times in whatever time zone you prefer.

“How do I do that?“

Easy! Simply override the default time zone (UTC) with the parameter called: tz.

In this tutorial, we’ll be adding the ‘tz’ parameter to a request with the livescores endpoint. This will result in the following URL:

https://soccer.sportmonks.com/api/v2.0/livescores/now?api_token={API_TOKEN}&tz=Asia/Singapore

And just like that, we've successfully requested the data to be returned in the Asian/Singaporean time zone instead of the default UTC. There are a lot more time zones available. You can find a list of valid time zones on Wikipedia.

When you’ve parsed an invalid time zone, you’ll get the error code 400. For an overview of all error codes see our response code page.

Now that you’ve successfully changed the time zone to your desired one, we can move on to explore the next part of our tutorial series, which is about pagination.

Note that changing the timezone currently does not change the results queried from the databases. It only changes the time attributes.

Last updated