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

Get Range for Specific Interval #33

Open
chriscannon opened this issue Jul 15, 2013 · 3 comments
Open

Get Range for Specific Interval #33

chriscannon opened this issue Jul 15, 2013 · 3 comments

Comments

@chriscannon
Copy link

Is there a way with Delorean stops to return date intervals between a start and stop date? For example, if I set start date to 2013-06-01 and end date to 2013-06-08 and I'd like the stop to return a date range of 7 days it should return the date range 2013-06-01 to 2013-06-07 and then just the single date of 2013-06-08.

@myusuf3
Copy link
Owner

myusuf3 commented Jul 15, 2013

http://delorean.readthedocs.org/en/latest/quickstart.html#with-power-comes

If I understand you correct something like ths?

>>> import delorean
>>> from delorean import stops
>>> from datetime import datetime
>>> d1 = datetime(2012, 5, 06)
>>> d2 = datetime(2013, 5, 06)

>>> for stop in stops(freq=delorean.DAILY, count=10, timezone="US/Eastern", start=d1, stop=d2):    print stop
...
Delorean(datetime=2012-05-06 00:00:00-04:00, timezone=US/Eastern)
Delorean(datetime=2012-05-07 00:00:00-04:00, timezone=US/Eastern)
Delorean(datetime=2012-05-08 00:00:00-04:00, timezone=US/Eastern)
Delorean(datetime=2012-05-09 00:00:00-04:00, timezone=US/Eastern)
Delorean(datetime=2012-05-10 00:00:00-04:00, timezone=US/Eastern)
Delorean(datetime=2012-05-11 00:00:00-04:00, timezone=US/Eastern)
Delorean(datetime=2012-05-12 00:00:00-04:00, timezone=US/Eastern)
Delorean(datetime=2012-05-13 00:00:00-04:00, timezone=US/Eastern)
Delorean(datetime=2012-05-14 00:00:00-04:00, timezone=US/Eastern)
Delorean(datetime=2012-05-15 00:00:00-04:00, timezone=US/Eastern)

@chriscannon
Copy link
Author

Sorry this is difficult to explain. My question really can be broken down into two questions:

  1. Can Delorean return date ranges as opposed to just a specific time instant?
  2. If the answer to Inconsistent naming in Readme #1 is yes, can Delorean return various date range lengths between a given start and stop date?

@myusuf3
Copy link
Owner

myusuf3 commented Jul 15, 2013

  1. yes
  2. yes

Look at the code and link I pasted above.

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

2 participants