pipolars.AFTime - PIPolars 0.1.0 documentation

Skip to content
Back to top
View this page
Edit this page

# pipolars.AFTime

class pipolars.AFTime

  Bases: `object`

  Represents a PI AF Time specification.

  Supports both absolute timestamps and relative time expressions like “*” (now), “*-1d” (1 day ago), “t” (today), etc.

  Examples

      >>> AFTime("*")  # Now
      >>> AFTime("*-1h")  # 1 hour ago
      >>> AFTime("2024-01-01")  # Absolute date
      >>> AFTime("t")  # Today at midnight
      >>> AFTime("y")  # Yesterday at midnight

  __init__(expression)

  Methods

  `__init__`(expression) |
  `ago`(**kwargs) | Create an AFTime relative to now.
  `from_datetime`(dt) | Create an AFTime from a Python datetime object.
  `now`() | Create an AFTime representing the current time.
  `today`() | Create an AFTime representing today at midnight.
  `yesterday`() | Create an AFTime representing yesterday at midnight.

  Attributes

  `expression` | The time expression string.

  expression: str

    The time expression string.

  classmethod now()

    Create an AFTime representing the current time.

  classmethod today()

    Create an AFTime representing today at midnight.

  classmethod yesterday()

    Create an AFTime representing yesterday at midnight.

  classmethod ago(**kwargs)

    Create an AFTime relative to now.

    Parameters:

      **kwargs (int) – Time units (days, hours, minutes, seconds)

    Returns:

      AFTime representing the relative time.

    Return type:

      AFTime

    Example

        >>> AFTime.ago(days=1, hours=2)  # 1 day and 2 hours ago

  classmethod from_datetime(dt)

    Create an AFTime from a Python datetime object.

  __init__(expression)