OH3 DateTime format in YAML

Hello All

I am using an Item State as Title in a oh-label card, the State of the Item is DateTime Format.
The Items State Description is set,

and the State of the Item is shown correct.

In the oh-label card the raw State is shown.

Datetime4

and the YAML

component: oh-label-card
config:
  action: group
  item: Muellkalender_Ergebnistitel1
  actionGroupPopupItem: muell
  fontSize: 18px
  iconUseState: true
  icon: oh:muell
  vertical: false
  title: =items.Muellkalender_Ergebnisstart1.state

Is it possible to format the Item State in the YAML to get the correct State description?

Use =items.Muellkalender_Ergebnisstart1.displayState

That was fast, thank you smarthomepch :+1:
It works

1 Like

Hello!
sorry for my possibly silly question:
I’ve exactly the same problem: I want to change the format of an item state in YAML(the footer). Example is a short Statusdisplay of a computer:

component: oh-label-card
config:
  item: MacMini_Online
  title: Mac Mini
  footer: =items.MacMini_LastSeen.state
  background: =(items.MacMini_Online.state=="ON") ? "lightgreen" :"red"
  trendItem: MacMini_Online
  action: analyzer
  actionAnalyzerItems:
    - MacMini_Online
  icon: f7:desktopcomputer

What I would like to have is a display in the UI like:
2021-03-04 00:10 (Year, Month, Day, Hour, Minute )
instead of
2021-03-04T00:03:55.260+0100

I saw your explanation, but, where to edit the item metadata?
Actually, I have only .state and do not know where to define something like .displaystate

Thanks in advance

Thanks to all. Solution found here: