msticpy.common.timespan module

Timespan class.

class msticpy.common.timespan.TimeSpan(*args, timespan: Optional[Union[TimeSpan, Tuple[Any, Any], Any]] = None, start: Optional[Union[datetime, str]] = None, end: Optional[Union[datetime, str]] = None, period: Optional[Union[timedelta, str]] = None)

Bases: object

Timespan parameter for notebook modules.

Initialize Timespan.

  • timespan (Union(TimeSpan, Tuple(Any, Any), Any), optional) – A TimeSpan object or a tuple of datetimes or datetime strings, or an object that has either start and end or start and period date_time-like attributes. By default None

  • start (Optional[Union[datetime, str]], optional) – datetime of the start of the time period, by default None

  • end (Optional[Union[datetime, str]], optional) – datetime of the end of the time period, by default utcnow

  • period (Optional[Union[timedelta, str]], optional) – duration of the period, by default None

  • parameters (If passed unnamed) –

  • of (the arguments can one) –

  • strings) (- a TimeSpan object (or a tuple of start/end dates or) –

  • datetime (- a start datetime and and end) –

  • period. (- a start datetime and a numeric) –


ValueError – If neither start nor period are specified.

property end: datetime

Return the end of the timeperiod.


End datetime.

Return type


property period: timedelta

Return the period of the timeperiod.


Period timedelta.

Return type


property start: datetime

Return the start of the timeperiod.


Start datetime.

Return type