Youtube API reading incorrect times

Has anyone had a situation where the Google API picking up upload time given you a result that isn’t true?

For example: 2023-04-29T21:10:04Z

This is the return from the API for today’s video that was uploaded. The thing is, I’m in Missouri (Central Daylight Time) and it’s currently 20:40. The originator is in Florida so we’re dealing with a 1 hour difference.

This individual releases videos around 3, maybe 5 at most. Technically, when I first ran my code, this video hasn’t been released yet. So it’s adding about 6 hours to the time.

Can I assume it’s using some odd timezone?

>Solution :

The timestamp returned by Google API is in UTC timezone (Denotes with the Z at the back of the string): 2023-04-29T21:10:04Z

After a bit of conversion, this is equivalent to 2023-04-29 16:10:04 of your timezone (CT / UTC-5), which should match your expectation of the "adding 6 hours to the time"

Leave a Reply