Item label and variables

I have a hopefully stupid simple question:

As I do not often change things in OpenHab I wondered where I can find the syntax of how to include variables in Item Text. I normally copy from another user and test, like the example below. But I d rather would like to know when to use %s and other variables like those below and to understand.

DateTime Sunrise_Time “Sonnenaufgang [%1$tH:%1$tM]”
DateTime Sunset_Time “Sonnenuntergang [%1$tH:%1$tM]”

Maybe this topic will help.

You mean that part? It’s not really “variables” but formatting options for a UI to use to display the Item state. “State presentation”

Thank you for the halp.
Yes, it is this part. So I do not understand the formating options. Some of the contributor use them to add values to a label of an item. I do not understand the semantics. I carried together from several blog entries that:
%s is string
%d is Integer
%f ist floating point %.0f = no decimals, %.1f is one number after the decimal point etc.
My q for you: Is there a general description of all these formatting options? Or are some specific to some interfaces, bindings etc?
Example: When I added the sunrise from Astro binding to the sitemap it showed something like this: 2020-06-06 5:36. I didn’t whant to display the date, only the time. Finally I found a contribution with the format [%1$tH:%1$tM] that did what I liked to have. But honestly I had no clue what I was doing. What is the %1 for the $ and so on.

Thanks for your help.

Yes. See the link that I already gave. These are not openHAB specific formatting directives, they are inherited from the Java that openHAB runs in.

Many thanks! I found it finally. It is the java class formatter I was looking for.

I’m not quite sure what that has to do with the rest of this post.