How to format a DateTime attribute in the view?

Cantor, Scott cantor.2 at osu.edu
Wed Mar 13 12:41:05 UTC 2024


> I would like to format and localize it. Can anybody help me to solve
> this detail?

The IdP since V4 uses the standard Java classes introduced in, I want to say 8, for date/time handling.

The underlying attribute value type is java.time.Instant, per [1] (that's a 5.1 link, but the same class is in 4.x).

The relevant reference for the Formatting class in Java 11 is [2].

In a nutshell, you build the Formatter you want, and pass the getValue() result into it to get a string out.

-- Scott

[1] https://shibboleth.net/api/java-shib-attribute/5.1.0/net/shibboleth/idp/attribute/DateTimeAttributeValue.html
[2] https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/format/DateTimeFormatter.html



More information about the users mailing list