Is there a list of date/time variables for formatting the date and time

I’m testing various way to display the date and time in more readable formats. I was finally able to get it to display, I’m just wondering if there is a list of variables for Openhab 3. Here is a screenshot of what I am doing:

Thank you for any help you can give me.

Todd

Please check here, like mentione in the docs :
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Formatter.html#syntax

The following conversion characters are used for formatting dates:

'B' Locale-specific full month name, e.g. "January", "February".
'b' Locale-specific abbreviated month name, e.g. "Jan", "Feb".
'h' Same as 'b'.
'A' Locale-specific full name of the day of the week, e.g. "Sunday", "Monday"
'a' Locale-specific short name of the day of the week, e.g. "Sun", "Mon"
'C' Four-digit year divided by 100, formatted as two digits with leading zero as necessary, i.e. 00 - 99
'Y' Year, formatted as at least four digits with leading zeros as necessary, e.g. 0092 equals 92 CE for the Gregorian calendar.
'y' Last two digits of the year, formatted with leading zeros as necessary, i.e. 00 - 99.
'j' Day of year, formatted as three digits with leading zeros as necessary, e.g. 001 - 366 for the Gregorian calendar.
'm' Month, formatted as two digits with leading zeros as necessary, i.e. 01 - 13.
'd' Day of month, formatted as two digits with leading zeros as necessary, i.e. 01 - 31
'e' Day of month, formatted as two digits, i.e. 1 - 31.

The following conversion characters are used for formatting common date/time compositions.

'R' Time formatted for the 24-hour clock as "%tH:%tM"
'T' Time formatted for the 24-hour clock as "%tH:%tM:%tS".
'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.
'D' Date formatted as "%tm/%td/%ty".
'F' ISO 8601 complete date formatted as "%tY-%tm-%td".
'c' Date and time formatted as "%ta %tb %td %tT %tZ %tY", e.g. "Sun Jul 20 16:17:00 EDT 1969".
1 Like

Thank you, Hans-Jörg. That was exactly what I was looking for.

The only issue I am having is that the list shows the letter conversions in first letter upper-cased and the rest of the word lower-case. My screen showed it all upper-case. I must be missing something, but I don’t see anywhere to fix it.

Examples

'B' Locale-specific full month name, e.g. "January", "February".

Thanks,

Todd

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.