Skip to content

Commit cc3fa7d

Browse files
rlippmannfrenck
andauthored
Update source/_docs/configuration/templating.markdown
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
1 parent 1159fb7 commit cc3fa7d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

source/_docs/configuration/templating.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ For example, if you wanted to select a field from `trigger` in an automation bas
459459
- `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.
460460
- `as_local()` converts datetime object to local time. This function can also be used as a filter.
461461
- `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 raises an error.
462-
- `relative_time(datetime,is_future=False,depth=1)` converts datetime object to its human-friendly time string. The time string can be in seconds, minutes, hours, days, months and years. `is_future` determines if the datetime is in the future or not. If `is_future` is left at its default of False, only datetimes in the past may be used, otherwise the unmodified datetime object is returned. If `is_future` is True, future datetimes may be used. In this case, if the datetime is in the past, the string "0 seconds" is returned. `depth` indicates the number of units returned with the last unit rounded (i.e `depth = 1` could return "2 years" while `depth = 2` could return "1 year 11 months"). This function can also be used as a filter.
462+
- `relative_time(datetime, is_future=False, depth=1)` converts datetime object to its human-friendly time string. The time string can be in seconds, minutes, hours, days, months, and years. `is_future` determines if the datetime is in the future or not. If `is_future` is left at its default of False, only datetimes in the past may be used, otherwise, the unmodified datetime object is returned. If `is_future` is True, future datetimes may be used. In this case, if the datetime is in the past, the string "0 seconds" is returned. `depth` indicates the number of units returned with the last unit rounded (i.e `depth = 1` could return "2 years" while `depth = 2` could return "1 year 11 months"). This function can also be used as a filter.
463463
- `timedelta` returns a timedelta object and accepts the same arguments as the Python `datetime.timedelta` function -- days, seconds, microseconds, milliseconds, minutes, hours, weeks.
464464

465465
{% raw %}

0 commit comments

Comments
 (0)