Timezone difference

Posted about 7 years ago by Diego Estela

Post a topic
Answered
D
Diego Estela

Hello, I'm having a problem when I parse dates on the cloud.

I use 'America/Montevideo' tz, and dates have 3 hour differences on the cloud. When I run locally I get correct dates.



0 Votes

nestor

nestor posted about 7 years ago Admin Best Answer

Please have a look at https://dateparser.readthedocs.io/en/latest/#timezone-and-utc-offset, there's a setting TO_TIMEZONE and other methods of converting timezone.

0 Votes


9 Comments

Sorted by
nestor

nestor posted about 7 years ago Admin

You're welcome

0 Votes

D

Diego Estela posted about 7 years ago

Yes, it worked using TO_TIMEZONE property.
Thanks nestor.

0 Votes

nestor

nestor posted about 7 years ago Admin Answer

Please have a look at https://dateparser.readthedocs.io/en/latest/#timezone-and-utc-offset, there's a setting TO_TIMEZONE and other methods of converting timezone.

0 Votes

D

Diego Estela posted about 7 years ago

Thanks for the help nestor.


I am already using that library, in my code I have something like this: 

dateparser.parse(date_formats=["%Y%m%d%H%M"], date_string=value,
                                          settings={'TIMEZONE': 'UYT'})

I use it in a serializer method (I also declared the serializer in the Item field) 

0 Votes

nestor

nestor posted about 7 years ago Admin

Seems like you're subtracting 3:00 from the date. You should probably use a library like dateparser (https://dateparser.readthedocs.io/en/latest/) to convert the dates.

0 Votes

D

Diego Estela posted about 7 years ago

I parse several dates from different sources, I need these dates to be exact (time and hours). The problem is that when I transform this string to a datetime object, it's behind 3 hours. 

I tried using timezone GMT-3, UYT, America/Montevideo and still get the same 3 hour-behind dates.



0 Votes

nestor

nestor posted about 7 years ago Admin

Could you explain the problem?

0 Votes

D

Diego Estela posted about 7 years ago

It happens the same if I use GMT-3

0 Votes

nestor

nestor posted about 7 years ago Admin

Scrapy Cloud is in UTC/GMT.

0 Votes

Login to post a comment