-
-
Notifications
You must be signed in to change notification settings - Fork 684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error in Time transform of 9999-12-31 #1159
Comments
I am unsure what the intended behavior would be here as 9999 is an odd input year. I can take on this - but could someone verify the intended behavior here? |
some system stored the timestamp of 9999 to mark the data will never be expired, and the passed date like 2022 means has expired 。And the BI System need to show as datetime like of 9999。so i need find a way to resolve it. On linux, the datetime.fromtimestamp can do this correctly, but , this function will raise error on windows when the datetime over 2038. So I am finding a way to hanle this problem both run well on Linux and Window. At least, the arrow can transform 9999 to timestamp correctly. By the way, the arrow can only tranform timestamp of 2999-12-31 to the correct datetime, timestamp of 3001 will be 1971 either. |
@funicia Have you solved this bug? If so can you share how you done it |
@yiransii Just in case you would still want to work on this one, the root cause for this is not year 9999 being invalid, but there's a rather obscure bug. When you construct an Arrow object from a timestamp, it calls normalize_timestamp from util.py. The first few lines:
MAX_TIMESTAMP is from constants.py:
What happens is that despite the comment, datetime.max.timestamp() only works on Linux if the local timezone is UTC or UTC-xx:
Going back to normalize_timestamp, this means 253402214400 gets divided by 1000, which then matches the original bug report:
|
Issue Description
i want to change '9999-12-31' to timestamp, and also in anather scene, i need change the timestamp(253402214400) to datetime.
but I got confused when I test this :
then get:
and change it to datetime:
arrow.get(253402214400.0)
but get :
this code should get result like of : "9999-12-31 "
So, It is a bug , or my code is not correct!
System Info
The text was updated successfully, but these errors were encountered: