Show Day in German

Thats my template:

{{ as_timestamp(state_attr('automation.giessen_pumpe_1_neu_2', 'last_triggered')) | timestamp_custom('%a %d.%m.%Y %-H:%M') }}

But how is it possible that it shows me the day in german???

With a workaround:

{% set x = state_attr('automation.giessen_pumpe_1_neu_2', 'last_triggered')) %}
{% set day_g = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"] %}
{% set month_g = ["Januar","Februar","März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"] %}
{{ day_g[x.weekday()-1]}} {{ x.day }} {{ month_g[x.month-1] }} {{x.year}}

Gives: Mittwoch 9 November 2023
I’m not German, so no idea if this is the correct order for you :rofl: But you can set the order by editing the last line. The -1 for weekday and month is because lists start at 0.

Stolen from: Get weekday in my local language? - #6 by petro

1 Like

Its perfect just a little syntax mistake. And the time is missing but i look in that thread that you postet.

I dont know if this is correct but it gives me my result that i need :rofl:

{% set x = state_attr('automation.giessen_pumpe_1_neu_2', 'last_triggered') %}
{% set day_g = ("Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag") %}
{% set month_g = ("Januar","Februar","März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember") %}
{{ day_g[x.weekday()-1]}} {{ x.day }}.{{ x.month }}.{{x.year}} {{ as_timestamp(state_attr('automation.giessen_pumpe_1_neu_2', 'last_triggered')) | timestamp_custom('%-H:%M ') }}

It shows me:

Dienstag 8.11.2023 14:54
{{x.hour}}:{{x.minute}}

Is a bit simpler :smiley:

1 Like

Ok thanks but how i can add the 0 in front the time it shows me now 9:8 oclock :sweat_smile:

Mittwoch 9.11.2023 9:8 Uhr
{{ as_timestamp(x) | timestamp_custom('%-H:%M ') }}

My main reason for that is you only have to adjust the first line in the template instead of twice. Since you already defined x just reuse it.
Now if you change the entity you only have to change the first line.

1 Like