Time and date formatting - Info

As I’m starting over from scratch again, I was trying to get my time and date formatting how I wanted. Of course, you will have to set up your NTP connections correctly to make it all work.
NTP servers for the US
My .things file:

ntp:ntp:ourhome  [ hostname="0.us.pool.ntp.org", refreshInterval=60, refreshNtp=30 ]

I wanted the date format to be Day-of-the-week, Month, Day and Year and the time to be in 12-hour format with AM/PM indication. Here is the format I used for the .items file:

// Display date as DOW, Full Month name, Day and Date
DateTime Date  "Date [%1$tA, %1$tB  %1$td, %1$tY]"  { channel="ntp:ntp:ourhome:dateTime" } 
// Display Time as 12 hour format with AM/PM
DateTime Time  "Time [%1$tI:%1$tM %1$Tp]" { channel="ntp:ntp:ourhome:dateTime" }

To get it to display on you sitemap screen add this to the .sitemap file:

Frame label="Today" {
        Text item=Date icon="calendar"
        Text item=Time  icon="time"
}

I found this site that explains what the code is inside the brackets:
Class formatter for Java

I have no knowledge of Java programming but this site did help figure out how to get the date and time formatted how I wanted.

This is my one contribution to the OH community.

John

Hopefully not the last one.

Thanks for posting!

Thanks Rick

The next project is to get the OpenWeatherMap loaded and working so I can check the local weather around our home. I may need some help on this one!