mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-15 13:26:54 +00:00
Add default
parameter to as_datetime
documentation (#31048)
This commit is contained in:
parent
eae332c2d0
commit
8cfc596b17
@ -587,7 +587,7 @@ For example, if you wanted to select a field from `trigger` in an automation bas
|
|||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
- `as_datetime()` converts a string containing a timestamp, or valid UNIX timestamp, to a datetime object.
|
- `as_datetime(value, default)` converts a string containing a timestamp, or valid UNIX timestamp, to a datetime object. If that fails, returns the `default` value, or if omitted raises an error. This function can also be used as a filter.
|
||||||
- `as_timestamp(value, default)` converts datetime object or string to UNIX timestamp. If that fails, returns the `default` value, or if omitted raises an error. This function can also be used as a filter.
|
- `as_timestamp(value, default)` converts datetime object or string to UNIX timestamp. If that fails, returns the `default` value, or if omitted raises an error. This function can also be used as a filter.
|
||||||
- `as_local()` converts datetime object to local time. This function can also be used as a filter.
|
- `as_local()` converts datetime object to local time. This function can also be used as a filter.
|
||||||
- `strptime(string, format, default)` parses a string based on a [format](https://docs.python.org/3.10/library/datetime.html#strftime-and-strptime-behavior) and returns a datetime object. If that fails, it returns the `default` value or, if omitted, raises an error.
|
- `strptime(string, format, default)` parses a string based on a [format](https://docs.python.org/3.10/library/datetime.html#strftime-and-strptime-behavior) and returns a datetime object. If that fails, it returns the `default` value or, if omitted, raises an error.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user