We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If i calculate the time difference between 2 datetime objects, the result is incorrect. Here an example:
import arrow start = arrow.get('28.04.2022 14:00','DD.MM.YYYY HH:mm' ) end = arrow.now() print(f'Start-Datetime: {start}') print(f'End-Datetime : {end}') print(f'Time-Difference: {end-start}')
Start-Datetime: 2022-04-28T14:00:00+00:00 End-Datetime : 2022-04-28T16:17:06.144073+02:00 Time-Difference: 0:17:06.144073
The correct Time-Difference should be 2:17:06......
The text was updated successfully, but these errors were encountered:
seems to be correct, the timezones differ by 2 hours, which makes up in the resulting time difference.
try specifying the timezones explicitly for now(), as it uses the local timezone, or switch to using utcnow().
Sorry, something went wrong.
Hi,
ok, I replaced the tzinfo for start to "Europe/Berlin". But that has no effect
start = arrow.now() start.replace(tzinfo='Europe/Berlin') end = arrow.get('30.04.2022 13:00','DD.MM.YYYY HH:mm') print(f'Start-Datetime: {start}') print(f'End-Datetime : {end}') print(f'Time-Difference: {end-start}')
Start-Datetime: 2022-04-30T12:22:02.977434+02:00 End-Datetime : 2022-04-30T13:00:00+00:00 Time-Difference: 2:37:57.022566
The correct Time-Difference should be 00:37:57......
@Gravitar64 start and end are still in different timezones, you need to specify it for both of them.
No branches or pull requests
If i calculate the time difference between 2 datetime objects, the result is incorrect. Here an example:
import arrow
start = arrow.get('28.04.2022 14:00','DD.MM.YYYY HH:mm' )
end = arrow.now()
print(f'Start-Datetime: {start}')
print(f'End-Datetime : {end}')
print(f'Time-Difference: {end-start}')
Start-Datetime: 2022-04-28T14:00:00+00:00
End-Datetime : 2022-04-28T16:17:06.144073+02:00
Time-Difference: 0:17:06.144073
The correct Time-Difference should be 2:17:06......
System Info
The text was updated successfully, but these errors were encountered: