Skip to content
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

Differences for ranges #30

Open
choptastic opened this issue Jan 17, 2017 · 0 comments
Open

Differences for ranges #30

choptastic opened this issue Jan 17, 2017 · 0 comments

Comments

@choptastic
Copy link
Owner

Qdate could benefit from more date arithmetic in the sense of finding out the difference between two dates.

difference_days(Date1, Date2) would return the number of days between those two dates.

difference_minutes(Date1, Date2) would do the same (though this is easy because of the easy conversion to unix timestamps - same with seconds (obviously), hours.

calculating differences of days with respect is more complicated if a range crosses a daylight savings time.

My gut is telling me that the answer to both is to strip off any time component and use just dates, then convert to gregorian days with calendar:date_to_gregorian_days(Date). From there, the math is simple. Maybe the time component could then be re-added to the original dates and the time component compared to retrieve the fractional part of a day with compared times.

Something to chew on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant