Configuring (ntp) time for 12 hour

Hi, i have the NTP binding, and simply trying to get 12 hour time with am/pm.

This is my .item line right now

DateTime Date “[%1$ta, %1$te %1$tb %1$tY, %1$tl:%1$tM %1$tp]” { channel=“ntp:ntp:datetime:dateTime” }

But, the time comes back as '2PM:16 PM"

Everything i read say “l” (lower case L) is supposed to just be 12 hour number, but it keeps putting a PM on it. same if i use “I” (cap eye). Thanks

In my config I do not get AM PM when using l (lower case L) or I (upper case eye). The difference is leading zero for hours 0 - 9.

Formatting overview here:

Is your locale settings correct? ref:
‘r’ Time formatted for the 12-hour clock as “%tI:%tM:%tS %Tp”. The location of the morning or afternoon marker (’%Tp’) may be locale-dependent.

Try to replace

DateTime Date "[%1$ta, %1$te %1$tb %1$tY, %1$tl:%1$tM %1$tp]" { channel="ntp:ntp:datetime:dateTime" }


DateTime Date "[%1$ta, %1$te %1$tb %1$tY, %1$tr]" { channel="ntp:ntp:datetime:dateTime" }

You will get the seconds in the time part!

Thank you! That does work, gets rid of the extra AM/PM after the hour. Do you know how i would get rid of the seconds w/ using the ‘r’ parameter? And cut reduce to single digit for the hour if it does not need it?

The r parameter is predefined so I don´t think you can change it, but your original setup works for me:

DateTime Luftfuktighet_Bad2_LUpdate	"Fukt bad 2. etg oppdatert [%1$ta, %1$te %1$tb %1$tY, %1$tl:%1$tM %1$tp	]"		<clock>			(Temperatur_2, TempUpd)

That is odd, thank you.

I’m having the same issue of times appearing like 5 PM:30 PM. It seems to be a locale issue but I’ve confirmed all my locale settings are set to English/United States.

It might be a formatting issue but I cannot see your formatting or OH version from here. :wink:

I’m on openHAB 2.4.0 Release build. The time formatting I’m using is:

[%1$tl:%1$tM %1$Tp]

Just looking quickly, I found this:


If you wanted to display your Time in a 12-hour format with AM/PM notation then you would use this format

DateTime Time  "Time [%1$tI:%1$tM %1$Tp]"

This will give you ex: 12:21 PM as shown on the Basic UI

When formatting the text, as shown above, pay careful attention to the CASE of the letters.

1 Like

Hi, I’m trying to format the time with the following item:

DateTime Time “Time [%1$tI:%1$tM %1$Tp]”

But I get this on PaperUI:

01 PM:31 PM

I don’t know where is that extra PM coming from.

Other formats work properly.


It’s the p at the end

I format mine like this [%1$tr]

sunset_time "Sunset [%1$tr]" <sunset> {channel="astro:sun:local:set#start"}


1 Like