dan-blanchard commented on issue #18139: [SPARK-20787][PYTHON] PySpark can't 
handle datetimes before 1900
URL: https://github.com/apache/spark/pull/18139#issuecomment-454536351
 
 
   Unfortunately, everything timezone-related in Python relies on the external 
`pytz` library (including the `tzlocal` library I'm suggesting we use here). 
There are ways you can try to figure out what timezone offset you're operating 
under without `tzlocal` or `pytz` (as seen in [this Stack Overflow 
thread](https://stackoverflow.com/questions/2720319/python-figure-out-local-timezone)),
 but those approaches will fall apart when some of your dates are near Daylight 
Saving Time boundaries. That's why the `localize` method is so important in the 
example I showed.
   
   Even if you were able to find the timezone on the Java side as to not add 
`tzlocal` as a Python dependency, you'd still need `pytz` to apply that 
timezone localization.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to