disagreement/docs/utils.md
Slipstream 3437050f0e
Some checks failed
Deploy MkDocs / deploy (push) Has been cancelled
Add snowflake_time utility (#105)
2025-06-15 18:52:38 -06:00

496 B

Utility Helpers

Disagreement provides a few small utility functions for working with Discord data.

utcnow

Returns the current timezone-aware UTC datetime.

snowflake_time

Converts a Discord snowflake ID into the UTC timestamp when it was generated.

from disagreement.utils import snowflake_time

created_at = snowflake_time(175928847299117063)
print(created_at.isoformat())

The function extracts the timestamp from the snowflake and returns a datetime in UTC.