doubledate.trimester#

doubledate.trimester(date, *, base=1)#

Returns the trimester of the given date.

Trimesters run from 1 January to 30 April, 1 May to 31 August and 1 September to 31 December.

Parameters:
  • date (datetime.date) – the date from which to determine the trimester

  • base (int, optional) – the index of the first trimester (default is 1)

Returns:

trimester’s index

Return type:

int

Examples

>>> trimester(datetime.date(2020, 5, 10))
2
>>> trimester(datetime.date(2020, 5, 10), base=0)
1
>>> trimester(datetime.date(2020, 9, 10))
3

See also

semester, quarter