I'm looking for a C++ library that has equivalent functionality to Python's dateutil
. Specifically, I want:
dateutil.parser.parse
: Given a string that represents a date, convert it to some kind of date object from which I can get seconds since the epoch. dateutil
can handle diverse strings like "January 1st, 2017", " "2017-01-01 18:00" and "Jan 1 17 7am" - if there's a C++ library that can automatically handle a variety of strings as well, that would be ideal.
dateutil.rrule
- Generate a list of dates and times from a rule. For instance, in Python I can get 7am every Saturday and Sunday between two dates by writing:
dateutil.rrule.rrule(
dateutil.rrule.DAILY,
byweekday=(dateutil.rrule.SA, dateutil.rrule.SU),
dtstart=datetime.datetime.combine(start_date_day, datetime.time(7, 00)),
until=datetime.datetime.combine(end_date_day, datetime.time(23, 59)))
I'm looking for the same ability to generate dates/times between dates with rules like the one above.
std::iota
andstd::transform
. 2. Can you explain what about the standard library's parsing capabilities is insufficient for you? I recall (although I'm not sure) that it does do some parsing.std::iota
helps. How would you write therrule
above withiota
? It would involve checking the days of week, the the start times, end times, etc., which is what I was hoping an existing library would handle for me