[SOLVED] DateTime display - abbreviate days of the week?

Tags: #<Tag:0x00007f616ddb6480>

When displaying date and time, the string gets pretty long. For example

Saturday, 09/19, 7:13AM.

How do you abbreviate Saturday to just “sat”? The item definition looks like this.

DateTime my_timestamp “Time [%1$tA, %1$tm/%1$td, %1$tI:%1$tM %1$tp]”

Thanks!

$ta

instead of

$tA

will give you the abbreviation for Sat.
See: http://download.java.net/jdk7/archive/b123/docs/api/java/util/Formatter.html

1 Like

Thanks! That’s probably the third time someone’s linked that to one of my date/time questions. I had a hard time finding it.

Much appreciated.

As a newbie, I also struggle with DateTime and formatting, thus an update to this old thread:
With Java 8, here the new link: https://docs.oracle.com/javase/8/docs/api/index.html?java/util/Formatter.html

Also note that you might find in openhab.org examples yet of joda.time. But it seems mostly depreciated and included in the Java 8 classes according to the main developer.