Need a little help with date/time formatting

See below.

I just want to display the last doorbell ring as “27-08-2020 10:46

I’ve been trying many things but got lost along the way…

platform: template
  sensors:
    deurel_time:
      friendly_name: "Laatste deurbel"
      value_template: ‘{{(states.camera.voordeur_last_ring.last_changed)}}’

Schermafbeelding 2020-08-27 om 13.01.57

value_template: "{{ as_timestamp( states.camera.voordeur_last_ring.last_changed )|timestamp_custom('%d-%m-%Y %H:%M') }}"

FYI other formatting options here: https://strftime.org/

The last_changed field of a State Object is a Python datetime, so you can just use its strftime method (instead of having to first convert it to a timestamp.)

value_template: "{{ states.camera.voordeur_last_ring.last_changed.strftime('%d-%m-%Y %H:%M') }}"

EDIT: Yeah, per comments below, the above will be in UTC. For the local time zone:

value_template: "{{ states.camera.voordeur_last_ring.last_changed.astimezone().strftime('%d-%m-%Y %H:%M') }}"

Thanks guys, for putting me on the right track.

The time in last_changed is UTC. If you want to display it in UTC then use pnbruckner’s suggestion. If you want to convert it to your local time, use tom_I’s suggestion.