doubledate.soq#

doubledate.soq(date: date, offset: int = 0) date#

Returns the first date of the quarter, i.e. one of 1 January, 1 April, 1 July or 1 October, then optionally offsets it by offset quarters.

Parameters:
  • date (datetime.date) – the date from which to compute the start of the quarter

  • offset (int, optional) – an offset from the start of the quarter of the date

Returns:

The start of the quarter

Return type:

datetime.date

Examples

>>> today = datetime.date(2020, 1, 15)
>>> soq(today):
datetime.date(2020,1,1)
>>> soq(today, 1)
datetime.date(2020,4,1)