Help with Lambda time+date

I’m trying to send time+date in a txt message.

I have the following working well to send the Time, however I cannot find anywhere how I can include the date in this Lambda.

Any ideas?

Thanks

!lambda 'return "Power Failure recorded at " + id(hatime).now().strftime("%H:%M");'

Google strftime and add the parameters for the date format that you want.

https://esphome.io/components/time/#strftime

1 Like