From 777a78bf6e206709716d6222cc3f875f054b7172 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Wed, 24 Nov 2021 09:52:13 +0100 Subject: [PATCH] Add UNIX timestamp detection to the as_datetime template filter (#20394) --- source/_docs/configuration/templating.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_docs/configuration/templating.markdown b/source/_docs/configuration/templating.markdown index eee936ff4e8..3ebd23cfa06 100644 --- a/source/_docs/configuration/templating.markdown +++ b/source/_docs/configuration/templating.markdown @@ -318,7 +318,7 @@ The same thing can also be expressed as a filter: {% endraw %} -- `as_datetime()` converts a string containing a timestamp to a datetime object. +- `as_datetime()` converts a string containing a timestamp, or valid UNIX timestamp, to a datetime object. - `as_timestamp(value, default)` converts datetime object or string to UNIX timestamp. If that fails, returns the `default` value, or if omitted `None`. This function also be used as a filter. - `as_local()` converts datetime object to local time. This function also be used as a filter. - `strptime(string, format)` parses a string based on a [format](https://docs.python.org/3.8/library/datetime.html#strftime-and-strptime-behavior) and returns a datetime object. If that fails, returns the `default` value, or if omitted the unprocessed input value.