Formating String and Displaying in UI

Hi All

I would like to format the value for string item. The string is holding a date. I have defined statedescription pattern and it shows up as undefined
image

The yaml code for the widget is below

component: oh-label-cell
config:
  expandable: false
  item: loadshedding_counter
  stateAsHeader: true
  title: Loadshedding Time
  footer: '= "StartTime:  " + items.ld_StartTime_item.displayState'

the statedescription pattern is below

value: " "
config:
  pattern: "%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS"

did you try

footer: '= "StartTime:  " + items.ld_StartTime_item.state'

?
What does your item show in openHAB MainUI Items menu?

Thank you Sebastian, yes that works but i would like to display the date differently hence i attempted using pattern

image

In an Label component I’m using this

text: ="Herausgegeben:\ " + @props.itemIssued

with this item pattern:

%1$td.%1$tm.%1$tY %1$tH:%1$tM

and it works.

I assume your item is of type datetime. That would work. In my case, my item is of type string hence my challenge. The above works on my items which are datetime. Iam needing to format an item which is a string type.

oh, my fault I should better read the question :grinning:
This should work:

footer: '= "StartTime:\ " + dayjs("2023-11-08T04:00:00+02:00").format("YYYY.MM.DD HH:mm:ss ")'
footer: '= "StartTime:\ " + dayjs(items.ld_StartTime_item.state).format("YYYY.MM.DD HH:mm:ss ")'

The description of dayjs().format you can find here
I hope it helps better :innocent:

Brilliant that is it. Just wwhat i wanted.

image