Date & time operators¶
commons.datetime_operators
¶
Functions:
| Name | Description |
|---|---|
date_range |
Creates a iterable range between two dates. |
utc_now |
Returns now datetime based on UTC time. |
is_today |
Check if the given datetime is today (UTC). |
is_past_week |
Check if the given datetime is within the past 7 days (UTC). |
is_past_month |
Check if the given datetime is within the past 30 days (UTC). |
is_past_three_months |
Check if the given datetime is within the past 90 days (UTC). |
is_this_year |
Check if the given datetime is in the specified year. Defaults to current year (UTC). |
date_range
¶
Creates a iterable range between two dates.
Source code in src/commons/datetime_operators.py
utc_now
¶
is_today
¶
is_past_week
¶
Check if the given datetime is within the past 7 days (UTC).
is_past_month
¶
Check if the given datetime is within the past 30 days (UTC).
is_past_three_months
¶
Check if the given datetime is within the past 90 days (UTC).
is_this_year
¶
Check if the given datetime is in the specified year. Defaults to current year (UTC).
If year is negative, it is treated as a relative offset from the current year. For example: -1 means last year, -2 means two years ago.