localdate
Convert an aware datetime to local time and return the value's date.
Only aware datetimes are allowed. When value is omitted, it defaults to now().
Local time is defined by the current time zone, unless another time zone is specified.
def localdate(
value: datetime.datetime = None,
timezone: datetime.tzinfo = None
) - > datetime.date
Convert an aware datetime to local time and return the value's date. Only aware datetimes are allowed. When value is omitted, it defaults to now(). Local time is defined by the current time zone, unless another time zone is specified.
Parameters
| Name | Type | Description |
|---|---|---|
| value | datetime.datetime = None | The aware datetime object to be converted; defaults to the current time if not provided. |
| timezone | datetime.tzinfo = None | The target time zone for the conversion; defaults to the currently active time zone. |
Returns
| Type | Description |
|---|---|
datetime.date | The date component of the converted datetime object in the target time zone. |