ds_common_placeholder_py_lib.functions.time¶
File: functions/time.py
Region: ds-common-placeholder-py-lib
Description¶
Time functions depend only on their arguments, never on the context: the
date functions compute from the time they are given, their last argument
(@{get_hour, UTC, '2026-05-03T01:30:00Z'}, or any reference the
caller’s context holds), or from the current time when none is (contract
§5). Outputs match the legacy
builtins at the same instant, except get_current_date, which returns an
ISO string.
Attributes¶
kept apart from any string, so |
Functions¶
|
Return the zone for an IANA name. |
|
Return name if it is |
|
The time value names, an RFC 3339 timestamp. |
|
First instant of last month, e.g. |
|
Last microsecond of last month, e.g. |
|
First day of last month, e.g. |
|
Last day of last month, e.g. |
|
Last month as |
|
The date, e.g. |
|
The day of month. |
|
The day of month one day before. |
|
The hour, 0-23. |
|
The local hour one elapsed hour before, 0-23. Across a DST change |
|
The current time to the second, e.g. |
|
The current UNIX timestamp in whole seconds. |
Module Contents¶
- ds_common_placeholder_py_lib.functions.time.check_timezone(name: str) zoneinfo.ZoneInfo[source]¶
Return the zone for an IANA name.
- Raises:
PlaceholderError –
argumentif the name is not an IANA zone.
- ds_common_placeholder_py_lib.functions.time.check_language(name: str) str[source]¶
Return name if it is
ENorNO.- Raises:
PlaceholderError –
argumentotherwise.
- ds_common_placeholder_py_lib.functions.time.NOT_GIVEN: Any¶
kept apart from any string, so
''is an error, never the current time.- Type:
The default of
at
- ds_common_placeholder_py_lib.functions.time.check_at(value: str) datetime.datetime[source]¶
The time value names, an RFC 3339 timestamp.
- Raises:
PlaceholderError –
argumentif value is not an RFC 3339 timestamp withZor an offset (''included).
- ds_common_placeholder_py_lib.functions.time.get_start_last_month(args: list[Any]) str[source]¶
First instant of last month, e.g.
2026-04-01T00:00:00+00:00.
- ds_common_placeholder_py_lib.functions.time.get_end_last_month(args: list[Any]) str[source]¶
Last microsecond of last month, e.g.
2026-04-30T23:59:59.999999+00:00.
- ds_common_placeholder_py_lib.functions.time.get_start_date_last_month(args: list[Any]) str[source]¶
First day of last month, e.g.
2026-04-01.
- ds_common_placeholder_py_lib.functions.time.get_end_date_last_month(args: list[Any]) str[source]¶
Last day of last month, e.g.
2026-04-30.
- ds_common_placeholder_py_lib.functions.time.get_last_month_period(args: list[Any]) str[source]¶
Last month as
<Month> <year>, e.g.April 2026.
- ds_common_placeholder_py_lib.functions.time.get_current_date(args: list[Any]) str[source]¶
The date, e.g.
2026-05-03.
- ds_common_placeholder_py_lib.functions.time.get_day_of_month(args: list[Any]) int[source]¶
The day of month.
- ds_common_placeholder_py_lib.functions.time.get_previous_day_of_month(args: list[Any]) int[source]¶
The day of month one day before.
- ds_common_placeholder_py_lib.functions.time.get_previous_hour(args: list[Any]) int[source]¶
The local hour one elapsed hour before, 0-23. Across a DST change this differs from
legacy, which subtracted wall time.