date¶
Provide date and Time Operations needed by snapintime.
- snapintime.utils.date.many_dates(start_date: datetime, interval_start: int, interval_end: int) list ¶
Provide a list of dates within a certain range.
Used by quarterly culling and yearly culling to determine date range to cull.
- Parameters
start_date – The reference point for the intervals
interval_start – How many days ago you want to start getting dates from.
interval_end – How many days ago you want to stop getting dates from.
- snapintime.utils.date.prior_date(start_date: datetime, day: int = 0) datetime ¶
Provide a prior date offset by the variable given in day.
Unintuitively, positive numbers subtract days.
- Parameters
start_date – The date from which you want to count back or forward.
day – The number of days you want to go back.
- Returns
A datetime object day amount of days in the past.
- snapintime.utils.date.quarterly_weeks(start_date: datetime) list ¶
Provide a list of 13 weekly date lists.
- Parameters
start_date – Date from which to go back a quarter.
- Returns
A list of lists containing datetime objects. Each sublist represents a week.
- snapintime.utils.date.yearly_quarters(start_date: datetime) list ¶
Provide a list of 4 quarterly date lists.
- Parameters
start_date – Date from which to go back a year.
- Returns
A list of lists containing datetime objects. Each sublist represents a quarter.