| | Posted: 25 Oct 2019 20:50 | |
zag
Posts: 3,527 Joined: 2020
| | Hi! I dont understand the time format Im seeing for games..Are they in UTC? Local time doesnt make sense either
This is for Laker game tonight which starts at 7:30PM PST:
dateEvent":"2019-10-26","dateEventLocal":"2019-10-25","strDate":null,"strTime":"03:30:00","strTimeLocal":"22:30:00"
What does "strTime" represent? it doesnt make sense to me in UTC or regular time. 3:30 AM UTC is 8:30PM PST so it seems to be off an hour.
Michael
| |
|
| | Posted: 26 Oct 2019 09:22 | |
zag
Posts: 3,527 Joined: 2020
| | strTime should be in UTC yes, local times are a pretty new feature that isnt perfect for American Sports yet(due tot he eastcoast/westcoast difference) but of course it can be edited by anyone on the front-end.
EDIT: Looks like you are correct, the UTC time was imported wrongly by -1hr, I will fix
EDIT2: Hopefully its fixed now, could you test a few future events? I had to loose the Local time as there are different time zones and it gets way too complicated
| |
|
| | Posted: 29 Oct 2019 19:15 | |
zag
Posts: 3,527 Joined: 2020
| | [quote="zag":1xjulurk]strTime
I have checked this and NBA events are still displaying UTC -1 times. I updated some of them starting from today and adding the +00:00 to the correct time to identify the ones that are currently correct
| |
|
| | Posted: 29 Oct 2019 20:32 | |
zag
Posts: 3,527 Joined: 2020
| | Hmm interesting, I wonder if the daylight saving change this weekend has thrown them all out again! argh.....
| |
|
| | Posted: 29 Oct 2019 20:35 | |
zag
Posts: 3,527 Joined: 2020
| | Hmm interesting, I wonder if the daylight saving change this weekend has thrown them all out again! argh.....
yes, I think so...
| |
|
| | Posted: 29 Oct 2019 22:50 | |
zag
Posts: 3,527 Joined: 2020
| | I updated again, this time from the official NBA API.
Sadly they use East Coast timings so I imported that. Hopefully it works now.
| |
|
| | Posted: 07 Jan 2020 20:00 | |
zag
Posts: 3,527 Joined: 2020
| | Hi new member as well in North America. Since your api times are UTC, if I use the API to get all events for today it shows yesterday's games for north american sports. So there is no good way to use this api to get today's games in north america. Actually all the data for any api has the wrong date for North America.
Any known work arounds? Any way you can add a string to all API's that you can specify a time zone or UTC-5 for example and it does the time math on the api side?
| |
|
| | Posted: 07 Jan 2020 20:03 | |
zag
Posts: 3,527 Joined: 2020
| | Hi new member as well in North America. Since your api times are UTC, if I use the API to get all events for today it shows yesterday's games for north american sports. So there is no good way to use this api to get today's games in north america. Actually all the data for any api has the wrong date for North America.
Any known work arounds? Any way you can add a string to all API's that you can specify a time zone or UTC-5 for example and it does the time math on the api side?
Hi and welcome!
All times and dates should now be in UTC so it should be pretty easy to convert that to local times with a function. How you do that in your choice of programming language might be another issue, especially with daylight savings time
Saying that, its my long term goal to have both local and UTC time for all events. We do this for NFL and soccer currently, next season we will look to do it for all imports.
| |
|
| | Posted: 07 Jan 2020 20:13 | |
zag
Posts: 3,527 Joined: 2020
| |
Hi and welcome!
All times and dates should now be in UTC so it should be pretty easy to convert that to local times with a function. How you do that in your choice of programming language might be another issue, especially with daylight savings time
Saying that, its my long term goal to have both local and UTC time for all events. We do this for NFL and soccer currently, next season we will look to do it for all imports.
Maybe I'm missing something but it's not that easy. If I want today's games using this api:
https://www.thesportsdb.com/api/v1/json/#####/eventsday.php?d=2020-01-07
It misses most North American sports since in UTC time they are on 2020-01-08 and shows games from the previous day.
But if I use that api for 2020-01-08 then some earlier games that are on 2020-01-07 are missed. So north american games are spilt between 2 days.
I get it's on your list but just want to make sure the issue is clear because I don't see an easy work around.
| |
|
| | Posted: 07 Jan 2020 23:31 | |
zag
Posts: 3,527 Joined: 2020
| | As an example in PHP you could do this I think
// create a $dt object with the UTC timezone
$dt = new DateTime('2016-12-12 12:12:12', new DateTimeZone('UTC'));
// change the timezone of the object without changing it's time
$dt->setTimezone(new DateTimeZone('America/Denver'));
// format the datetime
$dt->format('Y-m-d H:i:s T');
But other programming languages may vary.
| |
|