PIconnect.Time module#
Time related functions and classes.
- PIconnect.Time.timestamp_to_index(timestamp: DateTime) datetime#
Convert AFTime object to datetime in local timezone.
- Parameters:
(System.DateTime) (timestamp)
- Return type:
datetime: Datetime with the timezone info from
PIConfig.DEFAULT_TIMEZONE.
- PIconnect.Time.to_af_time(time: str | datetime) AFTime#
Convert a time to a AFTime value.
- Parameters:
datetime) (time (str |)
- Returns:
AFTime version of time.
- Return type:
- PIconnect.Time.to_af_time_range(start_time: str | datetime, end_time: str | datetime) AFTimeRange#
Convert a combination of start and end time to a time range.
Both start_time and end_time can be either a
datetime.datetimeobject or a string. datetime objects are first converted to a string, before being passed to AF.Time.AFTimeRange. It is also possible to specify either end as a datetime object, and then specify the other boundary as a relative string.- Parameters:
datetime) (end_time (str |)
datetime)
- Returns:
Time range covered by the start and end time.
- Return type: