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.
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.
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.
- Oldest First
- Popular
- Newest First
Sorted by Oldest Firstnestor
Scrapy Cloud is in UTC/GMT.
Diego Estela
It happens the same if I use GMT-3
nestor
Could you explain the problem?
Diego Estela
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.
nestor
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.
Diego Estela
Thanks for the help nestor.
I am already using that library, in my code I have something like this:
I use it in a serializer method (I also declared the serializer in the Item field)
nestor
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.
Diego Estela
Yes, it worked using TO_TIMEZONE property.
Thanks nestor.
nestor
You're welcome
-
Unable to select Scrapy project in GitHub
-
ScrapyCloud can't call spider?
-
Unhandled error in Deferred
-
Item API - Filtering
-
newbie to web scraping but need data from zillow
-
ValueError: Invalid control character
-
Cancelling account
-
Best Practices
-
Beautifulsoup with ScrapingHub
-
Delete a project in ScrapingHub
See all 460 topics