`datetime.timestamp` returns `float`, but Arrow's returns `int`
See original GitHub issueAs mentioned in https://github.com/crsmithdev/arrow/pull/464 (thanks @zmwangx!), Python 3.3 added a datetime.timestamp()
method returning a float
with microsecond precision. Unfortunately, Arrow already has an Arrow.timestamp
property, which is an int
with second precision.
As Arrow
is intended to be a drop-in replacement for datetime
, my opinion is that this forces us to implement a timestamp
method as well. We can implement this and maintain backwards compatibility if the timestamp
property returned an int
-like object that, when called, returned a float. Accessing it like a property could be accompanied with a DeprecationWarning
so we could remove this hack eventually.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
datetime.timestamp returns float , but Arrow's returns int #465
Python 3.3 added a datetime.timestamp() method returning a float with microsecond precision. Unfortunately, Arrow already has an Arrow.timestamp property, ...
Read more >Timestamp with utc and any other timezone is coming out to ...
Constructs an Arrow object from a timestamp, converted to the given timezone. Parameters: timestamp – an int or float timestamp, or a str...
Read more >Arrow: Better dates & times for Python — Arrow 1.2.3 ...
Arrow is a Python library that offers a sensible and human-friendly approach to creating, manipulating, formatting and converting dates, times and timestamps.
Read more >Complete Guide To Arrow: A Python Library for User-friendly ...
Arrow is a flexible Python library designed to handle dates, time, and timestamps in a sensible and human-friendly manner.
Read more >How to convert a float to timestamp or datetime?
When I try below method, I get errors about conversion. Cast(dbo.DateAndFracAsUnix(TimestampUTC, FractionOfASecond) as timestamp). Code Snippet.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @Syeberman, I am looking to fix this issue and was wondering where to start. I was looking at
arrow.py
and noticed that there is afloat_timestamp
method, and was wondering if this is as simple as creating a method calledtimestamp()
and simply mimicking the functionality offloat_timestamp
(reducing duplicate code of course). Any input is appreciated 😄 .https://github.com/sdispater/pendulum/issues/71 might be a useful reference.