period

class TH.TimePeriod(since_date: Optional[str] = None, to_date: Optional[str] = None, num_days: Optional[int] = None)

Determine staring and ending dates for all TH methods

days()int
Returns

The number of days for the current time period

end(format: Optional[str] = '%Y-%m-%d', utc: Optional[bool] = True)str

Obtain the final date of an interval

Parameters
  • format – String format required to format the output date string

  • utc – True to return initial date in UTC (GMT+0)

Returns

A string representation of the period’s starting date in the given format

ini(format: Optional[str] = '%Y-%m-%d', utc: Optional[bool] = True)str

Obtain the initial date of an interval

Parameters
  • format – String format required to format the output date string

  • utc – True to return initial date in UTC (GMT+0)

Returns

A string representation of the period’s starting date in the given format

set_num_days(num_days: int, ini: Optional[str] = None)None

Determine an interval based on starting data and time interval (in days)

Parameters
  • ini – Starting date in format YYYY-MM-DD

  • num_days – Number of days to be added to the starting date

set_period(ini: Union[str, pyforest._importable.datetime], end: Union[str, pyforest._importable.datetime])None

Determine an interval based on starting and ending dates

Parameters
  • ini – Starting date in format YYYY-MM-DD

  • end – Ending date in format YYYY-MM-DD

property date_end

Obtain the period final date (datetime)

property date_ini

Obtain the period initial date (datetime)

property timezone

:Obtain the current period configured timezone