Skip to content

Commit 91478d8

Browse files
lwisfabaff
authored andcommitted
Documentation for timestamp_custom (home-assistant#911)
1 parent ced030c commit 91478d8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

source/_topics/templating.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Home Assistant adds extensions to allow templates to access all of the current s
8080
- Filter `round(x)` will convert the input to a number and round it to `x` decimals.
8181
- Filter `timestamp_local` will convert an UNIX timestamp to local time/data.
8282
- Filter `timestamp_utc` will convert an UNIX timestamp to UTC time/data.
83+
- Filter `timestamp_custom(format_string, local_boolean)` will convert an UNIX timestamp to a custom format, the use of a local timestamp is default, supporting [Python format options](https://docs.python.org/3/library/time.html#time.strftime).
8384

8485
## {% linkable_title Examples %}
8586

@@ -199,4 +200,5 @@ It depends per component or platform but it is common to be able to define a tem
199200
# Timestamps
200201
{% raw %}{{ value_json.tst | timestamp_local }}{% endraw %}
201202
{% raw %}{{ value_json.tst | timestamp_utc }}{% endraw %}
203+
{% raw %}{{ value_json.tst | timestamp_custom('%Y' True) }}{% endraw %}
202204
```

0 commit comments

Comments
 (0)