How can I add 15 minutes to current date and time?


I am trying to do something that should be simple, but after reading through a lot of posts here I still can’t figure it out. If anybody wants to help me - thank you!

What I want is to get the date and time 15 minutes into the future. I have tried different things; but it just ends up as a mess of conversions between date times, int, float and str. Is there no easy way of doing this?

1 Like

Depending on what output you need, this will probably get you close:

{{ (now()|as_timestamp + (15*60))|timestamp_custom("%H:%M:%S", True) }}

Awesome, using this formating I got exactly what I was after. You got the right combination of formating and casting :slight_smile:

{{ (now() | as_timestamp + (15*60))|timestamp_custom("%Y-%m-%d %H:%M", True) }}
1 Like

If you’re planning on using this in an automation trigger, pay attention to the warning in the docs. See the time & date integration.