0

If I have two NSDate objects, a startDate and endDate, how could I easily create an array of date objects for each day inbetween these two dates, inclusive?

In Python it's quite easy:

import pandas as pd
from datetime import datetime
dr = pd.date_range('2012-07-01', '2012-08-01')
dr[(dr >= datetime(2012,7,4)) & (dr <= datetime(2012,7,8))]
Apollo
  • 8,874
  • 32
  • 104
  • 192
  • yes this http://stackoverflow.com/a/7859062/1578508 is definitely the answer to your questions.. there is no super nice interface.. you need to use the time interval – lukaswelte Jul 10 '14 at 17:26
  • 1
    http://stackoverflow.com/a/5067868/874027 - This is the one and only correct answer on SO, do not use the hardcoded 86400 seconds, you're gonna have a bad time – Eugene Jul 10 '14 at 17:29
  • @Eugene would you mind providing an example for how to apply the answer in the link you provided to this question? Thanks! – Apollo Jul 10 '14 at 18:15
  • @Eugene as well as specify why I would have a bad time? :) – Apollo Jul 10 '14 at 18:15
  • @Apollo can't provide an example since this is marked as dulicate and no answers are allowed to be posted, the bad time comes from daylight savings offsets, sometimes you'll get random incorrect dates by appending the 86400. – Eugene Jul 10 '14 at 18:58

0 Answers0